flightlessmango / MangoHud

A Vulkan and OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load and more. Discord: https://discordapp.com/invite/Gj5YmBb
MIT License
6.57k stars 292 forks source link

Mangohud complains about missing hwmon directory with AMD GPU #903

Open shmerl opened 1 year ago

shmerl commented 1 year ago
[2023-01-18 03:09:43.820] [MANGOHUD] [error] [file_utils.cpp:43] Error opening directory '/sys/class/drm/card0-HDMI-A-1/device/hwmon/': No such file or directory
[2023-01-18 03:09:43.820] [MANGOHUD] [error] [file_utils.cpp:43] Error opening directory '/sys/class/drm/card0-DP-2/device/hwmon/': No such file or directory

My case is amdgpu, Linux 6.1.6, RX 6800 XT.

There is no hwmon directory anywhere under /sys/class/drm/... in my setup.

It still reads GPU temperature OK though.

flightlessmango commented 1 year ago

Most likely it's using gpu_metrics instead, should be a line after that says something along those lines

flightlessmango commented 1 year ago

Also those probably shouldn't be errors since we don't expect to find hwmon in all of them

shmerl commented 1 year ago

Also, not sure if it's worth opening another bug. If you have a log level lower than info (like debug or trace), this message probably should also not be shown on the info level:

[MANGOHUD] [info] [overlay.cpp:768] Uploading is disabled (permit_upload = 0)
RPINerd commented 1 year ago

For the "no hwmon directory" error that isn't really an error, I believe I found the call that throws it on line 708 of overlay.cpp :

auto dirs = ls(drm.c_str(), "card");
      for (auto& dir : dirs) {
         if (dir.find("-") != std::string::npos) {
             continue; // filter display adapters
         }

That ls() call goes to file_utils.cpp where the error in question is thrown at line 46

I'm not going to embarass myself and attempt to write anything in C++, but it looks like the only way to halt that error would be to add in a clause within the ls() function itself to basically say if dir we're looking for has hwmon in it, don't throw error, else throw error. That feels like an irresponsible addition to clutter something as core as a file handling utility with special use cases, no?

RPINerd commented 1 year ago

Also, not sure if it's worth opening another bug. If you have a log level lower than info (like debug or trace), this message probably should also not be shown on the info level:

There is indeed a "Debug" level log, super easy to change line 800 of overlay.cpp from SPDLOG_INFO("Uploading is disabled (permit_upload = 0)"); To SPDLOG_DEBUG("Uploading is disabled (permit_upload = 0)"); If that indeed is not a "Info" worthy message