Resource use
Keyount is designed to be unnoticeable: event-driven, no polling
in the core, one tiny disk write per 2s at most while typing,
systemd-capped at 32 MB RAM / 5% CPU. These are measured numbers
(from the repo’s BENCHMARKS.md), not estimates — reproduce them
on your own hardware with make bench.
Headline numbers
Section titled “Headline numbers”| Component | Cost (measured) |
|---|---|
| Core counter | 0.0% CPU idle (blocks on key events), 13 MB RSS, ~230,000 events/s throughput (~4 µs/event), 1 tiny write / 2s max while typing |
| systemd caps (Linux) | MemoryMax=32M, CPUQuota=5%, Nice=10, idle IO scheduling |
| Widgets | one tiny bash command every 30s (6–16 ms), no Python startup — ≈ 0.05% duty cycle |
| Daily JSON save | median 0.14 ms, ~537 bytes |
Fast human typing is ~5–10 key events/sec, so the core has roughly 20,000× headroom. Even a CPU 20× slower than the benchmark VM stays far ahead of any typist.
How it was measured
Section titled “How it was measured”Environment: AMD EPYC 9D25 VM (4 vCPUs, 7.7 GiB RAM), Linux x86_64, Python 3.12.3 — a fast server CPU, so expect slower absolute numbers on a laptop; the margins are large enough that the conclusions hold on much slower hardware.
- Core throughput: 100,000 synthetic events in 0.43s = 231,390 events/s (heatmap on: 225,164/s — heatmap costs ~3% throughput; it’s off by default for privacy, not performance).
- Idle CPU: 0.0s CPU over a 3s steady-state window with no
input (the process blocks reading the libinput pipe), 13 MB RSS
— inside the unit’s
MemoryMax=32M. One-time Python startup costs ~30 ms CPU at service start. - Widget polls: worst case 16 ms every 30s ≈ 0.05% duty cycle; most of that is bash startup, the data read itself is one file.
- Heavy CLI modes (
week,month,info,export,report): ~50–90 ms against 365 days of data, dominated by Python startup. They run only when you type the command — never polled.
The Windows and macOS ports share the exact counting core
measured above (src/counter_core.py) and the same event-driven
design (hook / event-tap message loop, 0% CPU idle, ~15 MB RAM
typical for CPython). Windows has no systemd-style hard cap;
macOS runs at Nice=10 via its LaunchAgent.
Check on your machine
Section titled “Check on your machine”systemctl --user status keyount # snapshot: memory + CPU timesystemd-cgtop # live viewmake bench # full benchmark runmake bench-quick # small smoke test (also in CI)