Patch "perf script: Print "cgroup" field on the same line as "comm"" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf script: Print "cgroup" field on the same line as "comm"

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-script-print-cgroup-field-on-the-same-line-as-c.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 83a0be4ed36aefb4c05ed1696da45134d8f377f4
Author: Ivan Babrou <ivan@xxxxxxxxxxxxxx>
Date:   Mon Jul 17 17:07:37 2023 -0700

    perf script: Print "cgroup" field on the same line as "comm"
    
    [ Upstream commit 8c49c6e1a7b790c4cb9f464c5485117451d91c60 ]
    
    Commit 3fd7a168bf51 ("perf script: Add 'cgroup' field for output")
    added support for printing cgroup path in perf script output.
    
    It was okay if you didn't want any stacks:
    
        $ sudo perf script --comms jpegtran:23f4bf -F comm,tid,cpu,time,cgroup
        jpegtran:23f4bf 3321915 [013] 404718.587488:  /idle.slice/polish.service
        jpegtran:23f4bf 3321915 [031] 404718.592073:  /idle.slice/polish.service
    
    With stacks it gets messier as cgroup is printed after the stack:
    
        $ perf script --comms jpegtran:23f4bf -F comm,tid,cpu,time,cgroup,ip,sym
        jpegtran:23f4bf 3321915 [013] 404718.587488:
                        5c554 compress_output
                        570d9 jpeg_finish_compress
                        3476e jpegtran_main
                        330ee jpegtran::main
                        326e2 core::ops::function::FnOnce::call_once (inlined)
                        326e2 std::sys_common::backtrace::__rust_begin_short_backtrace
        /idle.slice/polish.service
        jpegtran:23f4bf 3321915 [031] 404718.592073:
                        8474d jsimd_encode_mcu_AC_first_prepare_sse2.PADDING
                    55af68e62fff [unknown]
        /idle.slice/polish.service
    
    Let's instead print cgroup on the same line as comm:
    
        $ perf script --comms jpegtran:23f4bf -F comm,tid,cpu,time,cgroup,ip,sym
        jpegtran:23f4bf 3321915 [013] 404718.587488:  /idle.slice/polish.service
                        5c554 compress_output
                        570d9 jpeg_finish_compress
                        3476e jpegtran_main
                        330ee jpegtran::main
                        326e2 core::ops::function::FnOnce::call_once (inlined)
                        326e2 std::sys_common::backtrace::__rust_begin_short_backtrace
    
        jpegtran:23f4bf 3321915 [031] 404718.592073:  /idle.slice/polish.service
                        8474d jsimd_encode_mcu_AC_first_prepare_sse2.PADDING
                    55af68e62fff [unknown]
    
    Fixes: 3fd7a168bf514979 ("perf script: Add 'cgroup' field for output")
    Signed-off-by: Ivan Babrou <ivan@xxxxxxxxxxxxxx>
    Acked-by: Ian Rogers <irogers@xxxxxxxxxx>
    Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
    Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
    Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
    Cc: Mark Rutland <mark.rutland@xxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Cc: kernel-team@xxxxxxxxxxxxxx
    Link: https://lore.kernel.org/r/20230718000737.49077-1-ivan@xxxxxxxxxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 200b3e7ea8dad..517bf25750c8b 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2199,6 +2199,17 @@ static void process_event(struct perf_script *script,
 	if (PRINT_FIELD(RETIRE_LAT))
 		fprintf(fp, "%16" PRIu16, sample->retire_lat);
 
+	if (PRINT_FIELD(CGROUP)) {
+		const char *cgrp_name;
+		struct cgroup *cgrp = cgroup__find(machine->env,
+						   sample->cgroup);
+		if (cgrp != NULL)
+			cgrp_name = cgrp->name;
+		else
+			cgrp_name = "unknown";
+		fprintf(fp, " %s", cgrp_name);
+	}
+
 	if (PRINT_FIELD(IP)) {
 		struct callchain_cursor *cursor = NULL;
 
@@ -2243,17 +2254,6 @@ static void process_event(struct perf_script *script,
 	if (PRINT_FIELD(CODE_PAGE_SIZE))
 		fprintf(fp, " %s", get_page_size_name(sample->code_page_size, str));
 
-	if (PRINT_FIELD(CGROUP)) {
-		const char *cgrp_name;
-		struct cgroup *cgrp = cgroup__find(machine->env,
-						   sample->cgroup);
-		if (cgrp != NULL)
-			cgrp_name = cgrp->name;
-		else
-			cgrp_name = "unknown";
-		fprintf(fp, " %s", cgrp_name);
-	}
-
 	perf_sample__fprintf_ipc(sample, attr, fp);
 
 	fprintf(fp, "\n");



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux