How do I get detailed flamegraphs with the flame crate for code written using Rayon?

272 Views Asked by At

I'm trying to get some performance metrics using the flame crate with code I've written using Rayon:

extern crate flame;

flame::start("TAG-A");
//Assume vec is a Vec<i32>
vec.par_iter_mut().filter(|a| a == 1).for_each(|b| func(b));
//func(b) operates on each i32 and sends some results to a channel
flame::end("TAG-A");
//More code but unrelated
flame::dump_stdout();

This works fine, but only gives information for the entire parallel iterator. I would like to get some more fine grained details on the function func.

I've tried adding a start/end within the function, but the runtime information is only available when I call flame::commit_thread() and then it seems to only print this to stdout. Ideally I'd like to print out the time spent without a given tag when I call dump at the end of my code.

Is there a way to dump tags from all threads? The documentation for flame isn't great.

0

There are 0 best solutions below