macro_rules! with {
($token:expr, $category:expr, { $($body:tt)* }) => { ... };
}
Expand description
Records a categorized measurement of the passed body
, in category
on token
.
§Example:
fn process(cogs: &Cogs, item: &Item) {
let mut token = cogs.timed(ResourceId::Relay, AppFeature::Transactions);
// The entire body is categorized as `processing`.
relay_cogs::with!(token, "processing", {
let success = do_something(&item);
});
// Not categorized.
if success {
do_something_else(&item);
}
}