Patch "perf report: Fix --total-cycles --stdio output error" has been added to the 6.10-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 report: Fix --total-cycles --stdio output error

to the 6.10-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-report-fix-total-cycles-stdio-output-error.patch
and it can be found in the queue-6.10 subdirectory.

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



commit 4fb4891ba7a9d2f9f52a10fc8a33947552aedb90
Author: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
Date:   Tue Aug 13 09:02:00 2024 -0700

    perf report: Fix --total-cycles --stdio output error
    
    [ Upstream commit 3ef44458071a19e5b5832cdfe6f75273aa521b6e ]
    
    The --total-cycles may output wrong information with the --stdio.
    
    For example:
    
      # perf record -e "{cycles,instructions}",cache-misses -b sleep 1
      # perf report --total-cycles --stdio
    
    The total cycles output of {cycles,instructions} and cache-misses are
    almost the same.
    
      # Samples: 938  of events 'anon group { cycles, instructions }'
      # Event count (approx.): 938
      #
      # Sampled Cycles%  Sampled Cycles  Avg Cycles%  Avg Cycles  [Program Block Range]
      # ...............  ..............  ...........  ..........  ..................................................>
      #
                11.19%            2.6K        0.10%           21  [perf_iterate_ctx+48 -> >
                 5.79%            1.4K        0.45%           97  [__intel_pmu_enable_all.constprop.0+80 -> __intel_>
                 5.11%            1.2K        0.33%           71  [native_write_msr+0 ->>
    
      # Samples: 293  of event 'cache-misses'
      # Event count (approx.): 293
      #
      # Sampled Cycles%  Sampled Cycles  Avg Cycles%  Avg Cycles  [Program Block Range]
      # ...............  ..............  ...........  ..........  ..................................................>
      #
                11.19%            2.6K        0.13%           21  [perf_iterate_ctx+48 -> >
                 5.79%            1.4K        0.59%           97  [__intel_pmu_enable_all.constprop.0+80 -> __intel_>
                 5.11%            1.2K        0.43%           71  [native_write_msr+0 ->>
    
    With the symbol_conf.event_group, the 'perf report' should only report the
    block information of the leader event in a group.
    
    However, the current implementation retrieves the next event's block
    information, rather than the next group leader's block information.
    
    Make sure the index is updated even if the event is skipped.
    
    With the patch,
    
      # Samples: 293  of event 'cache-misses'
      # Event count (approx.): 293
      #
      # Sampled Cycles%  Sampled Cycles  Avg Cycles%  Avg Cycles  [Program Block Range]
      # ...............  ..............  ...........  ..........  ..................................................>
      #
               37.98%            9.0K        4.05%           299  [perf_event_addr_filters_exec+0 -> perf_event_a>
               11.19%            2.6K        0.28%            21  [perf_iterate_ctx+48 -> >
                5.79%            1.4K        1.32%            97  [__intel_pmu_enable_all.constprop.0+80 -> __intel_>
    
    Fixes: 6f7164fa231a5f36 ("perf report: Sort by sampled cycles percent per block for stdio")
    Reviewed-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
    Signed-off-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
    Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
    Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Cc: Ian Rogers <irogers@xxxxxxxxxx>
    Cc: Ingo Molnar <mingo@xxxxxxxxxx>
    Cc: Jin Yao <yao.jin@xxxxxxxxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Cc: Stephane Eranian <eranian@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240813160208.2493643-2-kan.liang@xxxxxxxxxxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 69618fb0110b6..8bebaba56bc3f 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -565,6 +565,7 @@ static int evlist__tty_browse_hists(struct evlist *evlist, struct report *rep, c
 		struct hists *hists = evsel__hists(pos);
 		const char *evname = evsel__name(pos);
 
+		i++;
 		if (symbol_conf.event_group && !evsel__is_group_leader(pos))
 			continue;
 
@@ -574,7 +575,7 @@ static int evlist__tty_browse_hists(struct evlist *evlist, struct report *rep, c
 		hists__fprintf_nr_sample_events(hists, rep, evname, stdout);
 
 		if (rep->total_cycles_mode) {
-			report__browse_block_hists(&rep->block_reports[i++].hist,
+			report__browse_block_hists(&rep->block_reports[i - 1].hist,
 						   rep->min_percent, pos, NULL);
 			continue;
 		}




[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