Skip to content

Wrong GPU Load sensor chosen #2411

@Alia5

Description

@Alia5

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(

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugThis issue/PR is related to unexpected behaviour in the program.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions