Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to show only gpu usage percent #167

Open
Lowrida opened this issue Jun 18, 2024 · 11 comments
Open

Option to show only gpu usage percent #167

Lowrida opened this issue Jun 18, 2024 · 11 comments

Comments

@Lowrida
Copy link

Lowrida commented Jun 18, 2024

A friend of mine has an older system and a dump to terminal takes a long time. Too long for a nice update in conky. He only wants the gpu usage. Is it possible to make an option for that?

He can't cat the gpu_usage_percent file, because Option not permitted

@clbr
Copy link
Owner

clbr commented Jun 18, 2024

I'm afraid it won't be any faster if the other values were ignored. The GPU usage queried is an "on/off" value, and to get a percentage it needs to be sampled over a certain time. That is, if you changed it to return immediately after one sample, you'd only get 0% or 100%, not very useful.

I'm not sure what file you're referring to? But for conky, you'd probably want a two-step solution so direct reads are fast. Run radeontop in the background, updating one file, and in conky's config you'd read that file.

@Lowrida
Copy link
Author

Lowrida commented Jun 18, 2024

Thank you for your reply.
I revered to /sys/class/drm/card0/device/gpu_busy_percent
Where does radeontop get it's gpu usage from? How does it calculate it?

@clbr
Copy link
Owner

clbr commented Jun 18, 2024

It uses the status register. "At this point in time, which units were on". By default it samples 120 times per second, and outputs once per second. So with the defaults, the calculation is the sum of 120 status reads divided by 120 (and multiplied by 100 so it becomes %).

@Lowrida
Copy link
Author

Lowrida commented Jun 18, 2024

Ah ok, now i get why it takes at least a second to perform a dump.
But even when i set tick to 10 it takes the same time to perform a dump..

@clbr
Copy link
Owner

clbr commented Jun 18, 2024 via email

@Lowrida
Copy link
Author

Lowrida commented Jun 18, 2024

Ok, thanks for the explanation! I guess running it in the background dumping to a file and then cat the file would be quicker then running it every time conky updates.

@Lowrida
Copy link
Author

Lowrida commented Jun 18, 2024

Problem is, the file grows in size very quickly! Is there an option to not append, but renew the file so only one line is in it?

@clbr
Copy link
Owner

clbr commented Jun 18, 2024 via email

@Lowrida
Copy link
Author

Lowrida commented Jun 18, 2024

radeontop -d - | keep-last-line.sh /tmp/gpu

That pipe doesn't work. That script does not get anything on $@ or $1 .

@clbr
Copy link
Owner

clbr commented Jun 18, 2024 via email

@Lowrida
Copy link
Author

Lowrida commented Jun 18, 2024

Yeah, no problem in scripting here... but the pipe does not work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants