From f5c76bf3a6adf0cf927c125d63d69ee2a9eae538 Mon Sep 17 00:00:00 2001 From: Rod S Date: Thu, 10 Aug 2023 09:53:21 -0700 Subject: [PATCH] Restore the ability to produce a meaningful flamegraph --- fontc/src/workload.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/fontc/src/workload.rs b/fontc/src/workload.rs index f5debcd9..fdc128f1 100644 --- a/fontc/src/workload.rs +++ b/fontc/src/workload.rs @@ -1,6 +1,5 @@ //! Tracking jobs to run -use rayon::ThreadPoolBuilder; use std::{ collections::{HashMap, HashSet}, panic::AssertUnwindSafe, @@ -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