mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-11 07:52:50 -05:00
requires dankgop 0.0.3+
This commit is contained in:
@@ -21,9 +21,9 @@ Singleton {
|
|||||||
property string processSort: "cpu"
|
property string processSort: "cpu"
|
||||||
property bool noCpu: false
|
property bool noCpu: false
|
||||||
|
|
||||||
// Sampling data
|
// Cursor data for accurate CPU calculations
|
||||||
property var cpuSampleData: null
|
property string cpuCursor: ""
|
||||||
property var procSampleData: null
|
property string procCursor: ""
|
||||||
property int cpuSampleCount: 0
|
property int cpuSampleCount: 0
|
||||||
property int processSampleCount: 0
|
property int processSampleCount: 0
|
||||||
|
|
||||||
@@ -137,11 +137,11 @@ Singleton {
|
|||||||
|
|
||||||
// Clear cursor data when CPU or process modules are no longer active
|
// Clear cursor data when CPU or process modules are no longer active
|
||||||
if (!enabledModules.includes("cpu")) {
|
if (!enabledModules.includes("cpu")) {
|
||||||
cpuSampleData = null
|
cpuCursor = ""
|
||||||
cpuSampleCount = 0
|
cpuSampleCount = 0
|
||||||
}
|
}
|
||||||
if (!enabledModules.includes("processes")) {
|
if (!enabledModules.includes("processes")) {
|
||||||
procSampleData = null
|
procCursor = ""
|
||||||
processSampleCount = 0
|
processSampleCount = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,12 +251,12 @@ Singleton {
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add sampling data if available
|
// Add cursor data if available for accurate CPU percentages
|
||||||
if ((enabledModules.includes("cpu") || enabledModules.includes("all")) && cpuSampleData) {
|
if ((enabledModules.includes("cpu") || enabledModules.includes("all")) && cpuCursor) {
|
||||||
cmd.push("--cpu-sample", JSON.stringify(cpuSampleData))
|
cmd.push("--cpu-cursor", cpuCursor)
|
||||||
}
|
}
|
||||||
if ((enabledModules.includes("processes") || enabledModules.includes("all")) && procSampleData) {
|
if ((enabledModules.includes("processes") || enabledModules.includes("all")) && procCursor) {
|
||||||
cmd.push("--proc-sample", JSON.stringify(procSampleData))
|
cmd.push("--proc-cursor", procCursor)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpuPciIds.length > 0) {
|
if (gpuPciIds.length > 0) {
|
||||||
@@ -290,13 +290,9 @@ Singleton {
|
|||||||
perCoreCpuUsage = cpu.coreUsage || []
|
perCoreCpuUsage = cpu.coreUsage || []
|
||||||
addToHistory(cpuHistory, cpuUsage)
|
addToHistory(cpuHistory, cpuUsage)
|
||||||
|
|
||||||
// Always update cursor data for next sampling
|
// Store the opaque cursor string for next sampling
|
||||||
if (cpu.cursor) {
|
if (cpu.cursor) {
|
||||||
cpuSampleData = {
|
cpuCursor = cpu.cursor
|
||||||
previousTotal: cpu.cursor.total,
|
|
||||||
previousCores: cpu.cursor.cores,
|
|
||||||
timestamp: cpu.cursor.timestamp
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +370,6 @@ Singleton {
|
|||||||
|
|
||||||
if (data.processes && Array.isArray(data.processes)) {
|
if (data.processes && Array.isArray(data.processes)) {
|
||||||
const newProcesses = []
|
const newProcesses = []
|
||||||
const newProcSample = []
|
|
||||||
processSampleCount++
|
processSampleCount++
|
||||||
|
|
||||||
for (const proc of data.processes) {
|
for (const proc of data.processes) {
|
||||||
@@ -392,19 +387,12 @@ 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 || "")
|
||||||
})
|
})
|
||||||
|
|
||||||
// Always extract cursor data from pticks for next sampling call
|
|
||||||
if (proc.pid && typeof proc.pticks !== 'undefined') {
|
|
||||||
newProcSample.push({
|
|
||||||
pid: proc.pid,
|
|
||||||
previousTicks: proc.pticks,
|
|
||||||
timestamp: new Date().getTime()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
processes = newProcesses
|
processes = newProcesses
|
||||||
if (newProcSample.length > 0) {
|
|
||||||
procSampleData = newProcSample
|
// Store the single opaque cursor string for the entire process list
|
||||||
|
if (data.cursor) {
|
||||||
|
procCursor = data.cursor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user