Skip to content
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

Restore the ability to produce a meaningful flamegraph #391

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions fontc/src/workload.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Tracking jobs to run

use rayon::ThreadPoolBuilder;
use std::{
collections::{HashMap, HashSet},
panic::AssertUnwindSafe,
Expand Down Expand Up @@ -242,13 +241,9 @@ impl<'a> Workload<'a> {

// a flag we set if we panic
let abort_queued_jobs = Arc::new(AtomicBool::new(false));
// build a custom threadpool. we use this to ensure all threads are named
let threadpool = ThreadPoolBuilder::new()
.thread_name(|n| format!("tp{n}"))
.build()
.expect("failed to init thread pool");

threadpool.in_place_scope(|scope| {
// Do NOT assign custom thread names because it makes flamegraph root each thread individually
rayon::in_place_scope(|scope| {
// Whenever a task completes see if it was the last incomplete dependency of other task(s)
// and spawn them if it was
// TODO timeout and die it if takes too long to make forward progress or we're spinning w/o progress
Expand Down