Option to show only gpu usage percent
Opened this issue · 11 comments
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
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.
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?
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 %).
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..
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.
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?
radeontop -d - | keep-last-line.sh /tmp/gpu
That pipe doesn't work. That script does not get anything on $@
or $1
.
Yeah, no problem in scripting here... but the pipe does not work!