macro_rules! profile {
($operation:expr, $code:block) => { ... };
}
Expand description
Profile a code block using RAII timer
This macro creates a RAII timer that automatically records the duration when it goes out of scope. It takes an Operation and a code block.
ยงExample
use quantum_pulse::{profile, Category, Operation};
use std::fmt::Debug;
// Define your own operation type
#[derive(Debug)]
enum AppOperation {
DatabaseQuery,
}
impl Operation for AppOperation {}
let op = AppOperation::DatabaseQuery;
let result = profile!(op, {
42 // Your code here
});