Macro declare_static_timer

Source
macro_rules! declare_static_timer {
    ($name:ident, $key:expr_2021, $unit:path) => { ... };
}
Expand description

Create a thread safe static timer that can be used to measure durations. This macro creates a histogram with predefined boundaries appropriate for the specified time unit. Supported units are “ms” (milliseconds), “us” (microseconds), and “ns” (nanoseconds).

Example:

declare_static_timer!(REQUEST_TIMER, "request_processing_time", hyperactor_telemetry::TimeUnit::Millis);

{
    let _ = REQUEST_TIMER.start(kv_pairs!("endpoint" => "/api/users", "method" => "GET"));
    // do something expensive
}