Commit Graph

6 Commits

Author SHA1 Message Date
fanyang 1375cd1832 docs(stats): fix misleading/stale comments and rename test_counter
- GC test: cutoff is in the future, so every metric is stale by timestamp
  (not "nothing is stale"); only live handles retain.
- GC loop: drop the inaccurate "no Instant alloc" rationale.
- bench: the handle path no longer calls Instant::now() (it uses fastant);
  reword the HANDLE_TOTAL_WORK rationale.
- rename test_unsafe_counter -> test_counter to match the type rename.
2026-06-25 09:16:12 +08:00
fanyang ebb97fd4f4 refactor(stats): rename UnsafeCounter to Counter
The counter is now a plain atomic (no longer UnsafeCell, no longer
sharded), so the "Unsafe" prefix is a misleading leftover. Rename to
Counter. Also fix a stale bench comment that claimed the ShardedAtomic
variant mirrors production.
2026-06-25 00:59:49 +08:00
fanyang 7d249979ea Update outdated comment 2026-06-25 00:54:26 +08:00
fanyang 8fa161bc1b Fix clippy 2026-06-25 00:51:55 +08:00
fanyang 2624b2740e Code format 2026-06-25 00:48:40 +08:00
fanyang a247358ec1 test(bench): add counter contention benchmark
Adds benches/counter_contention.rs comparing the production CounterHandle
against reconstructed baselines (pre-optimization single-atomic + CAS +
Mutex<Instant>) under tokio-task contention, plus counter-only variants.
Uses the real stats_manager types so the numbers reflect shipped code.

Placed between the sharding and fastant commits so each can be benchmarked
independently: at this commit prod = sharded counter + Mutex<Instant> touch.
2026-06-25 00:06:38 +08:00