From af29a0e8f778caf010bfff8026908638fe180451 Mon Sep 17 00:00:00 2001 From: Cody Piersall Date: Mon, 31 Jul 2023 11:03:47 -0500 Subject: [PATCH] Add thread name to output when using record subcommand with thread_id option. (#599) Co-authored-by: Cody Piersall Co-authored-by: Ben Frederickson --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 50429e04..01730fa7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -256,8 +256,13 @@ fn record_samples(pid: remoteprocess::Pid, config: &Config) -> Result<(), Error> if config.include_thread_ids { let threadid = trace.format_threadid(); + let thread_fmt = if let Some(thread_name) = &trace.thread_name { + format!("thread ({}): {}", threadid, thread_name) + } else { + format!("thread ({})", threadid) + }; trace.frames.push(Frame { - name: format!("thread ({})", threadid), + name: thread_fmt, filename: String::from(""), module: None, short_filename: None,