mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-02 17:15:43 +00:00
perf(stats): lock-free fastant timestamp and fetch_add counter
Switch the counter add() from a fetch_update CAS loop to fetch_add, and replace MetricData's Mutex<Instant> timestamp with a lock-free AtomicU64 storing millis since a lazily-initialized base. Back now_millis() with fastant (TSC on x86_64 Linux, std fallback elsewhere) so touch() is cheap enough to call per packet. GC and its test compare in the millis domain. This is the change that actually delivers the performance: the Mutex timestamp was the serialization bottleneck, and removing it (plus the TSC clock) is what makes the handle path fast. No sharding.
This commit is contained in:
@@ -215,6 +215,7 @@ smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp.git", rev = "0a926767a6
|
||||
"async",
|
||||
] }
|
||||
parking_lot = { version = "0.12.0" }
|
||||
fastant = "0.1"
|
||||
|
||||
wildmatch = "2.3.4"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user