Skip to content

Commit

Permalink
Merge pull request #391 from googlefonts/fix_flamegraph
Browse files Browse the repository at this point in the history
Restore the ability to produce a meaningful flamegraph
  • Loading branch information
rsheeter authored Aug 10, 2023
2 parents 65cee59 + f5c76bf commit 51aa663
Showing 1 changed file with 2 additions and 7 deletions.
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

0 comments on commit 51aa663

Please sign in to comment.