Skip to content

Commit

Permalink
fix(graph): right init gpu memory
Browse files Browse the repository at this point in the history
fix #84
  • Loading branch information
orblazer committed May 22, 2024
1 parent dbe189d commit 2e76dc7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions package/contents/ui/components/graph/GpuGraph.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RMBaseGraph.TwoSensorsGraph {
}

// Graph options
realUplimits: [100, maxQueryModel.maxMemory]
realUplimits: maxQueryModel.maxMemory
sensorsModel.sensors: {
let sensors = [`gpu/${device}/usage`, `gpu/${device}/usedVram`];
if (showTemp) {
Expand All @@ -37,7 +37,7 @@ RMBaseGraph.TwoSensorsGraph {
// Override methods, for handle memeory in percent
_formatValue: (index, value) => {
if (index === 1 && memoryInPercent) {
return i18nc("Percent unit", "%1%", Math.round((value / maxQueryModel.maxMemory) * 1000) / 10); // This is for round to 1 decimal
return i18nc("Percent unit", "%1%", Math.round((value / maxQueryModel.maxMemory[1]) * 1000) / 10); // This is for round to 1 decimal
}
return _defaultFormatValue(index, value);
}
Expand All @@ -47,7 +47,7 @@ RMBaseGraph.TwoSensorsGraph {
id: maxQueryModel
sensors: [`gpu/${device}/totalVram`]
enabled: true
property int maxMemory: -1
property var maxMemory: [100, -1]

onDataChanged: topLeft => {
// Update values
Expand All @@ -56,7 +56,7 @@ RMBaseGraph.TwoSensorsGraph {
return;
}
enabled = false;
maxMemory = valueVar;
maxMemory = [100, valueVar]
}
}
}

0 comments on commit 2e76dc7

Please sign in to comment.