linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] perf sched timehist: decode process names of processes in zombie state
@ 2025-07-16 20:39 Anubhav Shelat
  2025-07-18  0:06 ` Namhyung Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Anubhav Shelat @ 2025-07-16 20:39 UTC (permalink / raw)
  To: mpetlan, acme, namhyung, irogers, linux-perf-users
  Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa,
	adrian.hunter, kan.liang, dapeng1.mi, james.clark, Anubhav Shelat

Previously when running perf trace timehist --state, when recording
processes in the zombie state the process name would not be decoded
properly and appears with just the PID:

1140057.412177 [0006]  Mutter Input Th[3139/3104]          0.956      0.019      0.041      S
1140057.412222 [0012]  :1248612[1248612]                   0.000      0.000      0.332      Z
1140057.412275 [0004]  <idle>                              0.052      0.052      0.953      I
1140057.412284 [0008]  <idle>                              0.070      0.070      0.932      I
1140057.412333 [0004]  KMS thread[3126/3104]               0.953      0.112      0.058      S

Now some extra processing has been added to decode the process name:

1140057.412177 [0006]  Mutter Input Th[3139/3104]          0.956      0.019      0.041      S
1140057.412222 [0012]  sleep[1248612]                      0.000      0.000      0.332      Z
1140057.412275 [0004]  <idle>                              0.052      0.052      0.953      I
1140057.412284 [0008]  <idle>                              0.070      0.070      0.932      I
1140057.412333 [0004]  KMS thread[3126/3104]               0.953      0.112      0.058      S

Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
---
 tools/perf/builtin-sched.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 26ece6e9bfd1..76e8b3fda02e 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -2174,6 +2174,11 @@ static void timehist_print_sample(struct perf_sched *sched,
 		printf(" ");
 	}
 
+	if (!thread__comm_set(thread)) {
+                const char *prev_comm = evsel__strval(evsel, sample, "prev_comm");
+                thread__set_comm(thread, prev_comm, sample->time);
+        }
+
 	printf(" %-*s ", comm_width, timehist_get_commstr(thread));
 
 	if (sched->show_prio)
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] perf sched timehist: decode process names of processes in zombie state
  2025-07-16 20:39 [PATCH v2] perf sched timehist: decode process names of processes in zombie state Anubhav Shelat
@ 2025-07-18  0:06 ` Namhyung Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2025-07-18  0:06 UTC (permalink / raw)
  To: mpetlan, acme, irogers, linux-perf-users, Anubhav Shelat
  Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa,
	adrian.hunter, kan.liang, dapeng1.mi, james.clark

On Wed, 16 Jul 2025 16:39:15 -0400, Anubhav Shelat wrote:
> Previously when running perf trace timehist --state, when recording
> processes in the zombie state the process name would not be decoded
> properly and appears with just the PID:
> 
> 1140057.412177 [0006]  Mutter Input Th[3139/3104]          0.956      0.019      0.041      S
> 1140057.412222 [0012]  :1248612[1248612]                   0.000      0.000      0.332      Z
> 1140057.412275 [0004]  <idle>                              0.052      0.052      0.953      I
> 1140057.412284 [0008]  <idle>                              0.070      0.070      0.932      I
> 1140057.412333 [0004]  KMS thread[3126/3104]               0.953      0.112      0.058      S
> 
> [...]
Applied to perf-tools-next, thanks!

Best regards,
Namhyung



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-18  0:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-16 20:39 [PATCH v2] perf sched timehist: decode process names of processes in zombie state Anubhav Shelat
2025-07-18  0:06 ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).