Module profiler

Module profiler 

Source
Expand description

Simple profiler for measuring function execution time.

This module provides a simple profiling utility to measure the execution time, call count and other statistics for functions and code blocks. It uses a global registry to store profiling data and a RAII guard (ProfileGuard) to automatically record timings.

ยงUsage

To profile a scope, use the profile_scope! macro at the beginning of the function or block you want to measure.

use crate::profiler::profile_scope;

fn my_function() {
    profile_scope!("my_function");
    // ... function logic ...
}

At the end of your program or at a convenient checkpoint, call print_profiling_results() to display the collected statistics.