tokio-rs / tokio

A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
https://tokio.rs
MIT License
26.59k stars 2.45k forks source link

metrics: create MetricAtomicUsize for usized-metrics #6598

Closed rcoh closed 4 months ago

rcoh commented 4 months ago

Motivation

https://github.com/tokio-rs/tokio/pull/6556#discussion_r1617778330

Metrics should not use Loom atomics. This clarifies this in code and also gives the opportunity to make a cleaner interface for metrics. We could potentially use this interface in the future to track things like the maximum value etc.

Solution

Introduce MetricAtomicUsize as the equivalent of MetricAtomicU64