From 92086dc707a7a7fb68f723cd8aa2814acf37b02d Mon Sep 17 00:00:00 2001 From: Nuri Amari Date: Thu, 2 Apr 2020 09:33:29 -0700 Subject: [PATCH] Add parentheses around thread id to prevent diff flamegraph The use of the --thread option can result in stack samples that look like "thread ". Inferno and Brendan Gregg's perl script will treat this as a frame function of with name "thread" and two counts. This results in the creation of differential flamegraph when not desired. Changing the frame name to "thread ()" fixes this issue. --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 68822e29..ccba2964 100644 --- a/src/main.rs +++ b/src/main.rs @@ -250,7 +250,7 @@ fn record_samples(pid: remoteprocess::Pid, config: &Config) -> Result<(), Error> if config.include_thread_ids { let threadid = trace.format_threadid(); - trace.frames.push(Frame{name: format!("thread {}", threadid), + trace.frames.push(Frame{name: format!("thread ({})", threadid), filename: String::from(""), module: None, short_filename: None, line: 0, locals: None}); }