From f6796f372613ea54d5ac988f6430dc3501cb7d75 Mon Sep 17 00:00:00 2001 From: Asmir A Date: Wed, 10 Jun 2026 21:42:02 +0200 Subject: [PATCH] sysstats: refresh cpuFreq every 3rd tick instead of every tick /proc/cpuinfo is regenerated in full by the kernel on every read and its cost grows with core count, making it the priciest per-tick read. Bar frequency display doesn't need 1 Hz precision. Co-Authored-By: Claude Fable 5 --- services/SysStats.qml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/services/SysStats.qml b/services/SysStats.qml index bbc5966..64c070c 100644 --- a/services/SysStats.qml +++ b/services/SysStats.qml @@ -52,6 +52,12 @@ Singleton { // poll interval in seconds readonly property int interval: 1 + // cpuFreq comes from /proc/cpuinfo, which the kernel regenerates in full on + // every read (cost grows with core count) — the priciest per-tick read here. + // Frequency on a status bar doesn't need 1 Hz precision, so only refresh it + // every Nth tick instead of on the CPU%/mem hot path. + readonly property int freqEveryTicks: 3 + // discovered sysfs paths (filled once by discover.sh) property string tempPath: "" property string batPath: "" @@ -271,15 +277,17 @@ Singleton { } function _tickOnce() { + const doFreq = root._tick % root.freqEveryTicks === 0; + statView.reload(); - cpuInfoView.reload(); + if (doFreq) cpuInfoView.reload(); memView.reload(); routeView.reload(); if (root.tempPath) tempView.reload(); if (root.batPath) { batCapView.reload(); batStatusView.reload(); } _parseCpu(); - _parseFreq(); + if (doFreq) _parseFreq(); _parseMem(); _parseTemp(); _parseBattery();