fixed memory readings
This commit is contained in:
@@ -21,7 +21,7 @@ Singleton {
|
|||||||
property var previousCpuStats
|
property var previousCpuStats
|
||||||
property double gpuUsage: 0
|
property double gpuUsage: 0
|
||||||
property double gpuMemUsage: 0
|
property double gpuMemUsage: 0
|
||||||
|
property double totalMem: 0
|
||||||
Timer {
|
Timer {
|
||||||
interval: 1
|
interval: 1
|
||||||
running: true
|
running: true
|
||||||
@@ -63,15 +63,26 @@ Singleton {
|
|||||||
FileView { id: fileMeminfo; path: "/proc/meminfo" }
|
FileView { id: fileMeminfo; path: "/proc/meminfo" }
|
||||||
FileView { id: fileStat; path: "/proc/stat" }
|
FileView { id: fileStat; path: "/proc/stat" }
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: oneshotMem
|
||||||
|
command: ["nvidia-smi", "--query-gpu=memory.total", "--format=csv,noheader,nounits"]
|
||||||
|
running: true
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
totalMem = Number(this.text.trim())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: processGpu
|
id: processGpu
|
||||||
command: ["nvidia-smi", "--query-gpu=utilization.gpu,utilization.memory", "--format=csv,noheader,nounits"]
|
command: ["nvidia-smi", "--query-gpu=utilization.gpu,memory.used", "--format=csv,noheader,nounits"]
|
||||||
running: false
|
running: false
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
const parts = this.text.trim().split(", ")
|
const parts = this.text.trim().split(", ")
|
||||||
gpuUsage = Number(parts[0]) / 100
|
gpuUsage = Number(parts[0]) / 100
|
||||||
gpuMemUsage = Number(parts[1]) / 100
|
gpuMemUsage = Number(parts[1]) / totalMem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ Singleton {
|
|||||||
running: true
|
running: true
|
||||||
repeat: true
|
repeat: true
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
console.log("Checking for updates...")
|
|
||||||
updatesProc.running = true
|
updatesProc.running = true
|
||||||
interval = 60000
|
interval = 60000
|
||||||
}
|
}
|
||||||
@@ -29,7 +28,6 @@ Singleton {
|
|||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
const output = this.text
|
const output = this.text
|
||||||
const lines = output.trim().split("\n").filter(line => line.length > 0)
|
const lines = output.trim().split("\n").filter(line => line.length > 0)
|
||||||
console.log("Available updates:", lines)
|
|
||||||
availableUpdates = lines.length
|
availableUpdates = lines.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user