perf(mining): run the mine-when-idle check at 1 Hz, probe the GPU sparingly

checkIdleMining ran every frame: an X11 idle query and, with GPU-aware
idle detection, an nvidia-smi launch on the UI thread per frame.

- The check runs once a second, since its decisions work on a seconds
  scale (the idle delay is tens of seconds or more). A miner it started
  or scaled up still yields on the first frame that sees the user back:
  that path skips the gate, because frames can be seconds apart while
  the app idles.
- The GPU is probed only when input is idle and the result can change
  a decision, at most every 5 s, with hysteresis (busy at 10%+, clear
  below 5%) so a GPU hovering near 10% can't keep restarting the miner.
- Thread scaling returns early when no miner is running or a toggle is
  in flight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 19:52:10 -05:00
co-authored by Claude Opus 5.5
parent 7ceff1eaaa
commit 2cf183ddd9
3 changed files with 42 additions and 14 deletions
+1 -1
View File
@@ -966,7 +966,7 @@ void App::update()
checkAutoLock();
}
// Mine-when-idle check (runs every frame, internally rate-limited by idle detection)
// Mine-when-idle check (cheap on most frames: it gates itself to 1 Hz)
checkIdleMining();
// P8: Dedup rebuildAddressList — only rebuild once per frame