1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-09 15:05:39 -05:00

dankgop sampling version

This commit is contained in:
bbedward
2025-08-09 17:16:30 -04:00
parent 3f5eb1844c
commit b3310e3edd

View File

@@ -21,6 +21,10 @@ Singleton {
property string processSort: "cpu" property string processSort: "cpu"
property bool noCpu: false property bool noCpu: false
// Sampling data
property var cpuSampleData: null
property var procSampleData: null
property real cpuUsage: 0 property real cpuUsage: 0
property real cpuFrequency: 0 property real cpuFrequency: 0
property real cpuTemperature: 0 property real cpuTemperature: 0
@@ -235,6 +239,14 @@ Singleton {
return [] return []
} }
// Add sampling data if available
if ((enabledModules.includes("cpu") || enabledModules.includes("all")) && cpuSampleData) {
cmd.push("--cpu-sample", JSON.stringify(cpuSampleData))
}
if ((enabledModules.includes("processes") || enabledModules.includes("all")) && procSampleData) {
cmd.push("--proc-sample", JSON.stringify(procSampleData))
}
if (gpuPciIds.length > 0) { if (gpuPciIds.length > 0) {
cmd.push("--gpu-pci-ids", gpuPciIds.join(",")) cmd.push("--gpu-pci-ids", gpuPciIds.join(","))
} }
@@ -262,6 +274,15 @@ Singleton {
cpuModel = cpu.model || "" cpuModel = cpu.model || ""
perCoreCpuUsage = cpu.coreUsage || [] perCoreCpuUsage = cpu.coreUsage || []
addToHistory(cpuHistory, cpuUsage) addToHistory(cpuHistory, cpuUsage)
// Update CPU sample data for the next run
if (cpu.total && cpu.cores) {
cpuSampleData = {
previousTotal: cpu.total,
previousCores: cpu.cores,
sampleTime: new Date().getTime()
}
}
} }
if (data.memory) { if (data.memory) {
@@ -338,6 +359,7 @@ Singleton {
if (data.processes && Array.isArray(data.processes)) { if (data.processes && Array.isArray(data.processes)) {
const newProcesses = [] const newProcesses = []
const newProcSample = []
for (const proc of data.processes) { for (const proc of data.processes) {
newProcesses.push({ newProcesses.push({
"pid": proc.pid || 0, "pid": proc.pid || 0,
@@ -350,8 +372,19 @@ Singleton {
"displayName": (proc.command && proc.command.length > 15) ? "displayName": (proc.command && proc.command.length > 15) ?
proc.command.substring(0, 15) + "..." : (proc.command || "") proc.command.substring(0, 15) + "..." : (proc.command || "")
}) })
if (proc.pid && typeof proc.pticks !== 'undefined') {
newProcSample.push({
pid: proc.pid,
previousTicks: proc.pticks,
sampleTime: new Date().getTime()
})
}
} }
processes = newProcesses processes = newProcesses
if (newProcSample.length > 0) {
procSampleData = newProcSample
}
} }
// Handle both gpu and gpu-temp module data // Handle both gpu and gpu-temp module data
@@ -485,7 +518,7 @@ Singleton {
command: root.buildDankgopCommand() command: root.buildDankgopCommand()
running: false running: false
onCommandChanged: { onCommandChanged: {
console.log("DankgopService command:", JSON.stringify(command)) //console.log("DankgopService command:", JSON.stringify(command))
} }
onExited: exitCode => { onExited: exitCode => {
if (exitCode !== 0) { if (exitCode !== 0) {