Crates.io | nm |
lib.rs | nm |
version | 0.1.18 |
created_at | 2025-06-05 07:25:35.563797+00 |
updated_at | 2025-08-01 03:55:38.500189+00 |
description | Minimalistic high-performance metrics collection in highly concurrent environments |
homepage | |
repository | https://github.com/folo-rs/folo |
max_upload_size | |
id | 1701166 |
size | 160,102 |
Collect metrics about observed events with low overhead even in highly multithreaded applications running on 100+ processors.
Using arbitrary development hardware, we measure between 2 and 20 nanoseconds per observation, depending on how the event is configured. Benchmarks are included.
use nm::Event;
use std::time::Duration;
thread_local! {
static PACKAGES_RECEIVED: Event = Event::builder()
.name("packages_received")
.build();
static PACKAGE_SEND_DURATION_MS: Event = Event::builder()
.name("package_send_duration_ms")
.build();
}
// observe_once() observes an event with a nominal magnitude of 1
PACKAGES_RECEIVED.with(Event::observe_once);
// observe_millis() observes an event with a magnitude in milliseconds
let send_duration = Duration::from_millis(150);
PACKAGE_SEND_DURATION_MS.with(|e| e.observe_millis(send_duration));
For each defined event, the following metrics are collected:
u64
).i64
).i64
).More details in the package documentation.
This is part of the Folo project that provides mechanisms for high-performance hardware-aware programming in Rust.