Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong GPU Load sensor chosen #2411

Open
Alia5 opened this issue Sep 6, 2023 · 0 comments
Open

Wrong GPU Load sensor chosen #2411

Alia5 opened this issue Sep 6, 2023 · 0 comments
Labels
Type: Bug This issue/PR is related to unexpected behaviour in the program.

Comments

@Alia5
Copy link

Alia5 commented Sep 6, 2023

Expected Behaviour

GPU-Load selects the D3D Load Sensor

Actual Behaviour

Selects "D3D Timer 0"

More Detailed description

Currently, the sensors are sorted by Id, in most cases, that works fine.
However, in my particular case (Probably true for other AMD users on Win11)

On my particular system the desired sensor (and with the lowest index at the end) is /gpu-amd/0/load/2
That however raises an issue, if there is a sensor with an Id ending in 10 or higher, as those will be sorted in before the desired sensor with a lower ending number.

(See sensor log snippet below)

Reproduction steps

Probably not too easy to reproduce.
I run a AMD 7900XTX on Win11

Aurora Version:

v185, but according to the sources the issue must still be present in master

Sensor Log Snippet

Expand
AMD Radeon RX 7900 XTX
Sensors:
Name: D3D Timer 0, Id: /gpu-amd/0/load/10, Type: Load
Name: D3D True Audio 0, Id: /gpu-amd/0/load/11, Type: Load
Name: D3D True Audio 1, Id: /gpu-amd/0/load/12, Type: Load
Name: D3D Video Codec 0, Id: /gpu-amd/0/load/13, Type: Load
Name: D3D Video Codec 1, Id: /gpu-amd/0/load/14, Type: Load
Name: D3D Video JPEG, Id: /gpu-amd/0/load/15, Type: Load
Name: D3D 3D, Id: /gpu-amd/0/load/2, Type: Load
Name: D3D Compute 0, Id: /gpu-amd/0/load/3, Type: Load
Name: D3D Compute 1, Id: /gpu-amd/0/load/4, Type: Load
Name: D3D Copy, Id: /gpu-amd/0/load/5, Type: Load
Name: D3D Copy, Id: /gpu-amd/0/load/6, Type: Load
Name: D3D High Priority 3D, Id: /gpu-amd/0/load/7, Type: Load
Name: D3D High Priority Compute, Id: /gpu-amd/0/load/8, Type: Load
Name: D3D Security 1, Id: /gpu-amd/0/load/9, Type: Load
Name: D3D Dedicated Memory Used, Id: /gpu-amd/0/smalldata/0, Type: SmallData
Name: D3D Shared Memory Used, Id: /gpu-amd/0/smalldata/1, Type: SmallData

Additional Notes:

I tried to update the sorting myself and open up a PR, but cannot get the build to work ¯_(ツ)_/¯
Any help would also be appreciated.

Assumed fix (patch file)
diff --git forkSrcPrefix/Project-Aurora/Project-Aurora/Utils/HardwareMonitor.cs forkDstPrefix/Project-Aurora/Project-Aurora/Utils/HardwareMonitor.cs
index 1c903a1c76e0297c4b0e70e5e80d689a5fc8927b..1ccef1bd692a505e677171d31a6fccaced38b5d5 100644
--- forkSrcPrefix/Project-Aurora/Project-Aurora/Utils/HardwareMonitor.cs
+++ forkDstPrefix/Project-Aurora/Project-Aurora/Utils/HardwareMonitor.cs
@@ -127,7 +127,7 @@ protected float GetValue(ISensor sensor)
 
             protected ISensor FindSensor(string identifier)
             {
-                var result = hw.Sensors.OrderBy(s => s.Identifier).FirstOrDefault(s => s.Identifier.ToString().Contains(identifier));
+                var result = hw.Sensors.OrderBy(s => s.Identifier).ThenBy(s => s.Identifier.ToString().Length).FirstOrDefault(s => s.Identifier.ToString().Contains(identifier));
                 if (result is null)
                 {
                     Global.logger.Error(
@@ -140,7 +140,7 @@ protected ISensor FindSensor(string identifier)
 
             protected ISensor FindSensor(SensorType type)
             {
-                var result = hw.Sensors.OrderBy(s => s.Identifier).FirstOrDefault(s => s.SensorType == type);
+                var result = hw.Sensors.OrderBy(s => s.Identifier).ThenBy(s => s.Identifier.ToString().Length).FirstOrDefault(s => s.SensorType == type);
                 if (result is null)
                 {
                     Global.logger.Error(

@Alia5 Alia5 added the Type: Bug This issue/PR is related to unexpected behaviour in the program. label Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug This issue/PR is related to unexpected behaviour in the program.
Projects
None yet
Development

No branches or pull requests

1 participant