Skip to content

feat: CPU overhead benchmark + autoresearch loop - #32

Open
samcm wants to merge 328 commits into
masterfrom
daring-bee-524
Open

feat: CPU overhead benchmark + autoresearch loop#32
samcm wants to merge 328 commits into
masterfrom
daring-bee-524

Conversation

@samcm

@samcm samcm commented Mar 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a full-system CPU overhead benchmark that measures observoor's real CPU cost when tracing via eBPF
  • Synthetic workload (stress-bench.c) generates deterministic syscall load across 4 threads
  • Measures CPU time via /proc/<pid>/stat (unaffected by noisy CI neighbors)
  • CI workflow triggered by bench-cpu label or workflow_dispatch
  • autoresearch/program.md provides context for codex-driven optimization loop

New files

  • bench-cpu/ — benchmark infrastructure (stress workload, mock beacon, runner, comparator)
  • .github/workflows/cpu-bench.yaml — CI workflow
  • autoresearch/program.md — research brief for autonomous optimization

@samcm samcm added bench-cpu Trigger CPU overhead benchmark and removed bench-cpu Trigger CPU overhead benchmark labels Mar 30, 2026
@samcm
samcm force-pushed the daring-bee-524 branch 2 times, most recently from 7e677d2 to 2a564a2 Compare April 1, 2026 00:42
@samcm samcm added bench-cpu Trigger CPU overhead benchmark and removed bench-cpu Trigger CPU overhead benchmark labels Apr 1, 2026
samcm added 21 commits April 4, 2026 17:23
autoresearch iteration 114: Remove direction from aggregation key
since TX/RX already use separate maps. Eliminates redundant pack/unpack.
autoresearch iteration 115: Only write min/max fields when the new
sample actually updates the extrema. Reduces memory stores per event.
autoresearch iteration 116: stress-bench doesn't use epoll_wait.
Moving it to cold path shrinks the hot per-PID aggregate.
autoresearch iteration 117: Force inlining on tiny hot-path aggregate
methods to reduce call overhead. Local microbench shows ~18% faster.
autoresearch iteration 118: Parser outputs local_port/remote_port
directly. Sink no longer branches on direction to swap src/dst.
autoresearch iteration 119: Same approach as TX/RX split. Disk reads
and writes no longer evict each other from FastMap last-hit cache.
autoresearch iteration 120: Running threads are few and small (~32B).
SmallVec<[_;8]> avoids heap allocation for typical core counts.
autoresearch iteration 121: Direct call to process_event_inner from
batch path. Removes one function call per event.
autoresearch iteration 122: Scheduler on_cpu/sched_wait latency no
longer inflates the hot basic_metrics entry. Syscall/FD/page-fault
paths hit a smaller aggregate.
autoresearch iteration 123: Each syscall type gets its own LatencyAggregate
map instead of sharing one large mixed aggregate. Smaller values = better
cache utilization per event.
autoresearch iteration 124: FD open/close and page faults no longer
share an aggregate. Each gets its own tiny map with last-hit cache.
autoresearch iteration 125: sched_switch and sched_runqueue no longer
share one map. Each gets its own small-value map with last-hit cache.
Removed unused BasicSchedulerAggregate. -47 lines.
autoresearch iteration 126: UDP send no longer carries unused TCP
fields (srtt_us, snd_cwnd) through the BPF hash map.
autoresearch iteration 127: sched_switch resolves running thread by
cpu_id array index (O(1)) instead of TID cache + linear scan.
Removes RunningThreadStore, TID cache, SmallVec. -76 lines.
autoresearch iteration 128: Repeated scheduler lookups for the same
TID skip the CPU slot scan via a small validated cache.
autoresearch iteration 129: After initial unaligned copy, field reads
should use aligned access. One-line repr change with size assertion.
autoresearch iteration 130: The every-1000-events stats callback only
wrote a constant zero gauge. Remove it from the hot loop. -15 lines.
autoresearch iteration 131: Combined scheduler events update both
aggregates in one pass instead of routing through separate handlers.
autoresearch iteration 132: Each CPU core gets its own FastMap for
cpu_on_core accounting. Scheduler events from different cores no
longer evict each other's last-hit cache. Smaller key (u64 vs u128).
autoresearch iteration 133: Avoid temporary CpuCoreDimension pack/unpack
when writing to per-core maps.
autoresearch iteration 134: Replace O(active_cpus) scan with direct
HashMap lookup for sched_runqueue/combined/process_exit paths.
samcm added 30 commits April 27, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bench-cpu Trigger CPU overhead benchmark

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant