y2kappa/timed

Enrich & customize chrome://tracing data to contain threadid, processid, tags

y2kappa opened this issue · 0 comments

It would be cool to add at least:

  • processId - afaik this should be easy, but not sure how expensive it it
  • threadId - from my research this was not obvious without using nightly, but maybe there is another way

But it would be great to also add tags, and as such, to add an extra macro derive attribute:

#[timed::timed(printer = "info!", tracing=true, tags = ["foo", "baz"])]
fn main() { } 

For this you'd need to modify:

#[derive(Debug, FromMeta)]
struct MacroArgs {
    #[darling(default)]
    printer: Option<String>,
    #[darling(default)]
    tracing: Option<bool>,
}

inside the macro crate: timed_prod_macros and add tags and process id and all the stuff to the Hop object

fn codegen_tracing(options: &MacroArgs, function_name: &str) -> (Option<Code>, Option<Code>) {
// stuff..
    timed::Trace::collect(timed::Hop { ph: timed::Phase::E, name: #function_name.to_string(), ts});
//
}