kernel/patches/0118-perf-stat-Introduce-perf_evlist__print_counters.patch
2023-11-10 14:47:39 +08:00

89 lines
3.0 KiB
Diff

From f58c620c83b508633e9e532906cb52fb54555e2a Mon Sep 17 00:00:00 2001
From: Jiri Olsa <jolsa@kernel.org>
Date: Thu, 30 Aug 2018 08:32:24 +0200
Subject: [PATCH 001/201] perf stat: Introduce perf_evlist__print_counters()
mainline inclusion
from mainline-v4.20-rc1
commit a5a9eac1a018ad3bfcf9a3ec11eae99fd35f466b
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8C0CX
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a5a9eac1a018ad3bfcf9a3ec11eae99fd35f466b
-----------------------------------------------------------------------
To be in charge of printing out the stat output. It will be moved out of
the 'perf stat' command in the following patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180830063252.23729-16-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: hongrongxuan <hongrongxuan@huawei.com>
---
tools/perf/builtin-stat.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index adabe9d4dc86..48327256f0bf 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1827,7 +1827,10 @@ static void print_footer(void)
"the same PMU. Try reorganizing the group.\n");
}
-static void print_counters(struct timespec *ts, int argc, const char **argv)
+static void
+perf_evlist__print_counters(struct perf_evlist *evlist,
+ struct timespec *ts,
+ int argc, const char **argv)
{
int interval = stat_config.interval;
struct perf_evsel *counter;
@@ -1859,14 +1862,14 @@ static void print_counters(struct timespec *ts, int argc, const char **argv)
print_aggr(prefix);
break;
case AGGR_THREAD:
- evlist__for_each_entry(evsel_list, counter) {
+ evlist__for_each_entry(evlist, counter) {
if (is_duration_time(counter))
continue;
print_aggr_thread(counter, prefix);
}
break;
case AGGR_GLOBAL:
- evlist__for_each_entry(evsel_list, counter) {
+ evlist__for_each_entry(evlist, counter) {
if (is_duration_time(counter))
continue;
print_counter_aggr(counter, prefix);
@@ -1878,7 +1881,7 @@ static void print_counters(struct timespec *ts, int argc, const char **argv)
if (metric_only)
print_no_aggr_metric(prefix);
else {
- evlist__for_each_entry(evsel_list, counter) {
+ evlist__for_each_entry(evlist, counter) {
if (is_duration_time(counter))
continue;
print_counter(counter, prefix);
@@ -1896,6 +1899,11 @@ static void print_counters(struct timespec *ts, int argc, const char **argv)
fflush(stat_config.output);
}
+static void print_counters(struct timespec *ts, int argc, const char **argv)
+{
+ perf_evlist__print_counters(evsel_list, ts, argc, argv);
+}
+
static volatile int signr = -1;
static void skip_signal(int signo)
--
2.27.0