#profiling #performance #macro #proc-macro #execution-time #time

macro tramer

A lightweight procedural macro library for profiling function execution time with customizable time units

3 releases

new 0.1.2 Feb 5, 2025
0.1.1 Feb 5, 2025
0.1.0 Feb 5, 2025

#1869 in Development tools

Download history 316/week @ 2025-02-01

316 downloads per month

MIT license

5KB

tramer

Crates.io Documentation License

Usage

add tramer to your Cargo.toml:

[dependencies]
tramer = "0.1.0"

use it:

use tramer::tramer;

#[tramer("millis")]
fn profile_millis() {
    std::thread::sleep(std::time::Duration::from_millis(150));
}

#[tramer("nanos")]
fn profile_nanos() {
    std::thread::sleep(std::time::Duration::from_micros(300));
}

#[tramer("secs")]
fn profile_seconds() {
    std::thread::sleep(std::time::Duration::from_millis(250));
}

Dependencies

~195–630KB
~15K SLoC