clbr / radeontop

GNU General Public License v3.0
804 stars 70 forks source link

Small support request #51

Closed franglais125 closed 7 years ago

franglais125 commented 7 years ago

Hi,

I'm working on adding support for GPU loads for a Gnome Shell extension (https://github.com/paradoxxxzero/gnome-shell-system-monitor-applet/pull/386).

Since I don't own a Radeon GPU, I can't test the tool. I was wondering if you could provide me with a way of getting the information needed in a succinct CLI way. I need: the GPU load, the vRAM used, and total vRAM.

Dummy example command:

radeontop | grep load
radeontop | grep vRAM

Thanks a lot for your time! Fran

clbr commented 7 years ago

Use the dump option.

radeontop --help

        RadeonTop for R600 and above.

        Usage: /usr/sbin/radeontop [-ch] [-b bus] [-d file] [-l limit] [-t ticks]

-b --bus 3              Pick card from this PCI bus
-c --color              Enable colors
-d --dump file          Dump data to this file, - for stdout
-l --limit 3            Quit after dumping N lines, default forever
-t --ticks 50           Samples per second (default 120)

-h --help               Show this help
-v --version            Show the version

So "radeontop -d -" to output to a pipe continuously, or if you want one-shot, add "-l 1".

Sample line:

1502903295.84311: gpu 0.00%, ee 0.00%, vgt 0.00%, ta 0.00%, sx 0.00%, sh 0.00%, spi 0.00%, sc 0.00%, pa 0.00%, db 0.00%, cb 0.00%, vram 30.01% 153.66mb
clbr commented 7 years ago

For total VRAM, you need to get that some other way.

franglais125 commented 7 years ago

Thanks a lot! That's exactly what I was looking for.

As for the total VRAM, can I do 153.66 / 30.01% = 512 MB to get the total?

9898287 commented 7 years ago
# radeontop -d - -l 1
Dumping to -, line limit 1.
1502903993.303070: gpu 0.83%, ee 0.00%, vgt 0.00%, ta 0.00%, sx 0.00%, sh 0.00%, spi 0.00%, sc 0.83%, pa 0.00%, db 0.00%, cb 0.83%, vram 4.95% 201.15mb
, gtt 0.12% 4.80mb
franglais125 commented 7 years ago

@9898287 , so in your exampe, the total VRAM is 201.15 / 4.95% = 4064mb ? I'm asking just to be sure.

Thanks a lot for the quick support!

9898287 commented 7 years ago

Yes, that's correct. Also,

$ echo $(dmesg | grep -o -P -i "(?<=vram:).*(?=M 0x)")$" Mb"
4096 Mb
franglais125 commented 7 years ago

Thanks again! Cheers.

franglais125 commented 7 years ago

It seems that root privileges are required to run radeontop. Any way around that?

clbr commented 7 years ago

Root rights are not required if your kernel is new enough, libdrm is new enough, and your user has access to the DRM node. If you tried to run radeontop without a Radeon card, it would fail to find one in DRM, and assume it needed the root path - even if your system otherwise was set up for non-root access.