diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-30 19:56:48 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-30 19:56:48 +0200 |
| commit | 96ac1ee65da31055704e0a14cafacc33914d7e86 (patch) | |
| tree | 8a8fa33ec27607f40d6d23661a89681ffbaa4456 /test/test_data.lua | |
| parent | e55896ce41d6165105671da5b6f33813106ef1b8 (diff) | |
| download | conky-theme-udt-96ac1ee65da31055704e0a14cafacc33914d7e86.tar.gz conky-theme-udt-96ac1ee65da31055704e0a14cafacc33914d7e86.zip | |
perf(dashboard): draw at 0.1s only while the dashboard is visible
Conky gives Lua no way to request one redraw, so a scroll showed up to
2s late. Pointer enter and leave, which Hyprland sends on every toggle
of the special workspace, now switch conky_set_update_interval between
0.1s and the config's 2s.
At that rate the CPU and network counters would sample over 0.1s
windows and the chart would fill 20x faster, so both now sample through
data.new_gate on the /proc/uptime clock, about every 2s, and redraw
their last values in between. The samplers move to texeci: execi runs
in the main loop and a 0.7s nvtable or an Immich download stalled the
scroll.
Measured: about 12% of one core while visible, 0.5% while hidden.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'test/test_data.lua')
| -rw-r--r-- | test/test_data.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_data.lua b/test/test_data.lua index ec95fae..2d4d5c7 100644 --- a/test/test_data.lua +++ b/test/test_data.lua @@ -478,3 +478,10 @@ assert(not up[6].behind and not up[6].bump, 'updates row 6: current') assert(up.upgrade == 3 and up.bump == 1 and up.current == 46 and up.missing == 18, 'updates summary') assert(data.nvtable_parse('') == nil, 'updates: empty cache is nil') + +-- new_gate: opens at most once per interval on the clock it is given. +local gate = data.new_gate(1.9) +assert(gate(100.0) == true, 'gate: first call opens') +assert(gate(100.5) == false, 'gate: closed inside the interval') +assert(gate(101.95) == true, 'gate: opens after it') +assert(gate(102.0) == false, 'gate: interval restarts from the last open') |
