114 lines
4.0 KiB
Diff
114 lines
4.0 KiB
Diff
From 5a195bd859f2468392df4a0aad9fde4ab80498d1 Mon Sep 17 00:00:00 2001
|
|
From: Kajol Jain <kjain@linux.ibm.com>
|
|
Date: Mon, 7 Sep 2020 12:11:32 +0530
|
|
Subject: [PATCH 131/201] perf metricgroup: Pass pmu_event structure as a
|
|
parameter for arch_get_runtimeparam()
|
|
|
|
mainline inclusion
|
|
from mainline-v5.10-rc1
|
|
commit f5a489dc8189bd6a6a418e408bada1ed5b9d02b1
|
|
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=f5a489dc8189bd6a6a418e408bada1ed5b9d02b1
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
This patch adds passing of pmu_event as a parameter in function
|
|
'arch_get_runtimeparam' which can be used to get details like if the
|
|
event is percore/perchip.
|
|
|
|
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
|
|
Acked-by: Ian Rogers <irogers@google.com>
|
|
Acked-by: Jiri Olsa <jolsa@redhat.com>
|
|
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
|
|
Cc: Andi Kleen <ak@linux.intel.com>
|
|
Cc: Jin Yao <yao.jin@linux.intel.com>
|
|
Cc: John Garry <john.garry@huawei.com>
|
|
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
|
|
Cc: Mark Rutland <mark.rutland@arm.com>
|
|
Cc: Namhyung Kim <namhyung@kernel.org>
|
|
Cc: Paul Clarke <pc@us.ibm.com>
|
|
Cc: Peter Zijlstra <peterz@infradead.org>
|
|
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
|
|
Link: http://lore.kernel.org/lkml/20200907064133.75090-5-kjain@linux.ibm.com
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: hongrongxuan <hongrongxuan@huawei.com>
|
|
---
|
|
tools/perf/arch/powerpc/util/header.c | 7 +++++--
|
|
tools/perf/util/metricgroup.c | 5 ++---
|
|
tools/perf/util/metricgroup.h | 3 ++-
|
|
3 files changed, 9 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c
|
|
index 0a3816692252..823c663d2296 100644
|
|
--- a/tools/perf/arch/powerpc/util/header.c
|
|
+++ b/tools/perf/arch/powerpc/util/header.c
|
|
@@ -48,8 +48,11 @@ get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
|
|
return bufp;
|
|
}
|
|
|
|
-int arch_get_runtimeparam(void)
|
|
+int arch_get_runtimeparam(struct pmu_event *pe)
|
|
{
|
|
int count;
|
|
- return sysfs__read_int("/devices/hv_24x7/interface/sockets", &count) < 0 ? 1 : count;
|
|
+ char path[PATH_MAX] = "/devices/hv_24x7/interface/";
|
|
+
|
|
+ atoi(pe->aggr_mode) == PerChip ? strcat(path, "sockets") : strcat(path, "coresperchip");
|
|
+ return sysfs__read_int(path, &count) < 0 ? 1 : count;
|
|
}
|
|
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
|
|
index edcd2b05311a..2d505fa62a6c 100644
|
|
--- a/tools/perf/util/metricgroup.c
|
|
+++ b/tools/perf/util/metricgroup.c
|
|
@@ -23,7 +23,6 @@
|
|
#include "rblist.h"
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
-#include "pmu-events/pmu-events.h"
|
|
#include "strlist.h"
|
|
#include <assert.h>
|
|
#include <ctype.h>
|
|
@@ -641,7 +640,7 @@ static bool metricgroup__has_constraint(struct pmu_event *pe)
|
|
return false;
|
|
}
|
|
|
|
-int __weak arch_get_runtimeparam(void)
|
|
+int __weak arch_get_runtimeparam(struct pmu_event *pe __maybe_unused)
|
|
{
|
|
return 1;
|
|
}
|
|
@@ -909,7 +908,7 @@ static int add_metric(struct list_head *metric_list,
|
|
} else {
|
|
int j, count;
|
|
|
|
- count = arch_get_runtimeparam();
|
|
+ count = arch_get_runtimeparam(pe);
|
|
|
|
/* This loop is added to create multiple
|
|
* events depend on count value and add
|
|
diff --git a/tools/perf/util/metricgroup.h b/tools/perf/util/metricgroup.h
|
|
index 23b4f44b3f39..3670a8528ca5 100644
|
|
--- a/tools/perf/util/metricgroup.h
|
|
+++ b/tools/perf/util/metricgroup.h
|
|
@@ -5,6 +5,7 @@
|
|
#include <linux/list.h>
|
|
#include <linux/rbtree.h>
|
|
#include <stdbool.h>
|
|
+#include "pmu-events/pmu-events.h"
|
|
|
|
struct perf_evsel;
|
|
struct perf_evlist;
|
|
@@ -52,6 +53,6 @@ int metricgroup__parse_groups_test(struct perf_evlist *evlist,
|
|
void metricgroup__print(bool metrics, bool groups, char *filter,
|
|
bool raw, bool details);
|
|
bool metricgroup__has_metric(const char *metric);
|
|
-int arch_get_runtimeparam(void);
|
|
+int arch_get_runtimeparam(struct pmu_event *pe __maybe_unused);
|
|
void metricgroup__rblist_exit(struct rblist *metric_events);
|
|
#endif
|
|
--
|
|
2.27.0
|
|
|