#events #counting #statistics #counter #count

innumerable

A simple crate for counting events in Rust libraries

1 unstable release

0.1.0 Aug 15, 2024

#769 in Machine learning

30 downloads per month

MIT/Apache

7KB
67 lines

innumerable

A simple crate for counting events in Rust libraries.


lib.rs:

A simple crate for counting events in Rust libraries.

This library is designed to be used in performance-sensitive code to gather statistics about the frequency of events. It can handle tens of millions of events per second on a single core with manageable performance overhead. Capturing events doesn't require passing any global context, making it well suited to instrument and optimize low level libraries within a larger program. Events are accumulated into thread-local counters and can be printed out at the end of the program.

Example

// Capture an event
innumerable::event!("event_name", 12);

// At program completion, print out the counts
innumerable::print_counts();

Dependencies

~2MB
~27K SLoC