tpenguin / gnome-stats-pro

Gnome-Stats-Pro display graphs of system resource utilization.
Other
23 stars 16 forks source link

GPU usage #13

Open BenjaminNavarro opened 6 years ago

BenjaminNavarro commented 6 years ago

Before installing gnome-stats-pro I tried system-monitor and, even if it is not what I wanted, they have a nice feature that I think would be very welcome here: GPU usage. They support only NVIDIA GPUs through the nvidia-smi tool. It has an option to output XML which would be very easy to parse. I tried it on my computer by running nvidia-smi --query --xml-format and you get all the necessary information:

<?xml version="1.0" ?>
<!DOCTYPE nvidia_smi_log SYSTEM "nvsmi_device_v9.dtd">
<nvidia_smi_log>
    <timestamp>Tue Jul 10 10:52:56 2018</timestamp>
    <driver_version>396.24</driver_version>
    <attached_gpus>1</attached_gpus>
    <gpu id="00000000:85:00.0">
        <product_name>GeForce GTX 1080 Ti</product_name>
        ....
        <fb_memory_usage>
            <total>11178 MiB</total>
            <used>0 MiB</used>
            <free>11178 MiB</free>
        </fb_memory_usage>
        ....
        <utilization>
            <gpu_util>0 %</gpu_util>
            <memory_util>0 %</memory_util>
            <encoder_util>0 %</encoder_util>
            <decoder_util>0 %</decoder_util>
        </utilization>
        ....
    </gpu>
</nvidia_smi_log>

Is it possible to integrate such a feature?

jbenden commented 6 years ago

I believe you have an excellent request, one which I would find helpful.

Unfortunately, there are a number of problems with this feature request.

The first problem is that I highly recommend against adding any sort of overhead processing to a GNOME Extension. These run in the same process space as the desktop itself; so anything that even minorly slows down the execution will effect all of the entire desktop experience. In short, I completely believe the logic of gathering GPU statistics belongs in libgtop project. I recommend that you bring up adding this functionality with them.

The other issue is that there are three major GPU makers: AMD, Intel, and NVIDIA. The example you have provided is for NVIDIA only. I have an AMD GPU, so I couldn't test functionality to ensure it works.

In summary, I'd recommend bringing up adding GPU statistics to libgtop project. If they accept the request, we end up with cross-platform support and most probably cross-GPU maker support.

References:

libgtop project: https://gitlab.gnome.org/GNOME/libgtop

AMD statistics: https://github.com/clbr/radeontop

NVIDIA monitor: https://github.com/mountassir/gmonitor

Original source of information: https://unix.stackexchange.com/questions/38560/gpu-usage-monitoring-cuda#38581

BenjaminNavarro commented 6 years ago

Ok I see. I'll bring this to the libgtop project and see how it goes. I'll keep you posted.