mgalgs / gnome-shell-system-monitor-applet

Display system informations in gnome shell status bar, such as memory usage, cpu usage, network rates…
https://extensions.gnome.org/extension/3010/system-monitor-next/
GNU General Public License v3.0
220 stars 19 forks source link

AMD multiple GPUs support #54

Closed Irkam closed 1 year ago

Irkam commented 1 year ago

Hey, I've come with a minor issue when the script attempted to access cat /sys/class/drm/card0/[...] while card0 did not exist for some reason and card1 was used instead, thus crashing the script into a syntax error.

The quick and dirty version is this:

elif lsmod | grep amdgpu > /dev/null; then
        # FIX `card1` instead of `card0` not existing
        card=card1
        total=$(cat /sys/class/drm/$card/device/mem_info_vram_total)
        echo $(($total / 1024 / 1024))

        used=$(cat /sys/class/drm/$card/device/mem_info_vram_used)
        echo $(($used / 1024 / 1024))

        cat /sys/class/drm/$card/device/gpu_busy_percent

And voilà. Maybe there could be a drop-down menu looking for deviceX in /sys/class/drm but I didn't look this one up yet. As added in the comments later this might have something to do with Ryzen integrated GPUs but I'm not sure right now.


This change is Reviewable