-
feat(bridge): power-aware perf watcher — reassert the chosen regime across AC/battery & resume · e94163f1
The incident: mid-session on battery the pstate held turbo down (~2.5 GHz, 60°C, CPU pressure ~0 — the set never needed more). Plugging in on AC at 4% silently lifted that limit; the SAME workload jumped to 4.4–4.5 GHz and 85–93°C with fans maxed. Nothing was working harder — the platform just reset the frequency cap underneath our "cool" mode, and the tooling never noticed. set_mode() was fire-and-forget: it wrote the cap once and moved on. Fix: treat the perf mode as DESIRED STATE and reconcile it whenever the platform can drift it (AC/battery flip, resume-from-suspend), with a periodic drift check as the safety net. perf.py - write_desired()/read_desired(): persist the user-chosen mode (~/.cache/ parvagues/perf-desired). "normal"/absent == maintenance off, so we never fight a deliberate switch back to platform defaults. - set_mode() records intent on every successful switch. - on_ac(): mains state from /sys/class/power_supply/A*/online. - reconcile(force): reassert desired if detect_mode() drifted (idempotent — "cool holding" when already in force, so no thrash). - run_watcher(): daemon loop. Reasserts (force) on a power-source edge and on resume (detected via a monotonic-clock gap), settling 2s for the platform; periodic force=False drift check otherwise. Seeds desired from the live mode on startup so an already-cool session is maintained immediately. bridge.py: launch run_watcher() as a daemon thread from `serve` (the always-on --user service is the right home; the tray is just a face). perf-tray.py: record intent (write_desired) on a successful tray switch too, so both faces agree and the watcher respects tray-initiated changes. Bonus: because "cool" also RT-schedules scsynth/sclang/Ardour/PipeWire, every reassert re-guarantees audio-chain priority after a power event — cheap insurance against post-transition xruns. Validated: compiles; reconcile idempotent; force reassert exercises the real perf-audio path (cool->cool, no disturbance); watcher thread confirmed live in the daemon with "on_ac=True desired=cool". Real power-transition proof lands on the next unplug/replug (logged to the bridge journal).PLN (Algolia) authorede94163f1
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| tests | Loading commit data... | |
| ui | Loading commit data... | |
| .gitignore | Loading commit data... | |
| README.md | Loading commit data... | |
| bridge.py | Loading commit data... | |
| launchers.py | Loading commit data... | |
| midimon.py | Loading commit data... | |
| midistream.py | Loading commit data... | |
| parvagues-bridge.desktop | Loading commit data... | |
| parvagues-bridge.service | Loading commit data... | |
| perf.py | Loading commit data... | |
| server.py | Loading commit data... |