-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't seem to work with multiple threads #42
Comments
I would also love to see this work in multi-threaded environments. |
I think the real problem here is that Rayon keeps those threads around in a pool, so the normal destructor-based solution doesn’t work. Try calling |
The Here's what I tried... let pool = rayon::ThreadPoolBuilder::new().exit_handler(|_| flame::commit_thread()).build().unwrap();
pool.install(|| {
/* code which does rayon things */
});
drop(pool);
flame::commit_thread();
flame::dump_html(&mut File::create("flame-graph.html").unwrap()).unwrap(); This code should ensure that each thread both runs the destructor based solution because when the pool is dropped the threads are dropped as well, and it runs the |
What is necessary here is in the |
Shameless plug, but @Ploppz @l-x-u you can check out https://github.com/wagnerf42/rayon-logs This shows you how rayon is splitting tasks and how much time is spent in each task. It however, does not have the flamegraph characteristics, in that it is not useful if you want callgraph information in multithreaded code. However, you can still add some hardware counters to parallel regions. |
Minimal test case:
Dependencies:
The written file has no graphics.
The output is:
[Thread { id: 140470522639296, name: Some("main"), spans: [], _priv: () }]
, so no data is available.The text was updated successfully, but these errors were encountered: