Crate time_graph_macros[][src]

A procedural macro attribute for instrumenting functions with time-graph.

time-graph provides always-on profiling for your code, allowing to record the execution time of functions, spans inside these functions and the actual call graph at run-time. This crate provides the #[instrument] procedural macro attribute.

Note that this macro is also re-exported by the main time-graph crate.

Usage

First, add this to your Cargo.toml:

[dependencies]
time-graph-macros = "0.1.0"

The #[instrument] attribute can now be added to a function to automatically create a time-graph callsite, and enter the corresponding span when that function is called. For example:

use time_graph_macros::instrument;

#[instrument]
pub fn my_function(my_arg: usize) {
    // ...
}

Attribute Macros

instrument

Instruments a function to create and enter a time-graph span every time the function is called.