提交 f5a489dc 编写于 作者: K Kajol Jain 提交者: Arnaldo Carvalho de Melo

perf metricgroup: Pass pmu_event structure as a parameter for arch_get_runtimeparam()

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: NKajol Jain <kjain@linux.ibm.com>
Acked-by: NIan Rogers <irogers@google.com>
Acked-by: NJiri 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.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 560ccbc4
...@@ -40,8 +40,11 @@ get_cpuid_str(struct perf_pmu *pmu __maybe_unused) ...@@ -40,8 +40,11 @@ get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
return bufp; return bufp;
} }
int arch_get_runtimeparam(void) int arch_get_runtimeparam(struct pmu_event *pe)
{ {
int count; 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;
} }
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "rblist.h" #include "rblist.h"
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include "pmu-events/pmu-events.h"
#include "strlist.h" #include "strlist.h"
#include <assert.h> #include <assert.h>
#include <linux/ctype.h> #include <linux/ctype.h>
...@@ -636,7 +635,7 @@ static bool metricgroup__has_constraint(struct pmu_event *pe) ...@@ -636,7 +635,7 @@ static bool metricgroup__has_constraint(struct pmu_event *pe)
return false; return false;
} }
int __weak arch_get_runtimeparam(void) int __weak arch_get_runtimeparam(struct pmu_event *pe __maybe_unused)
{ {
return 1; return 1;
} }
...@@ -904,7 +903,7 @@ static int add_metric(struct list_head *metric_list, ...@@ -904,7 +903,7 @@ static int add_metric(struct list_head *metric_list,
} else { } else {
int j, count; int j, count;
count = arch_get_runtimeparam(); count = arch_get_runtimeparam(pe);
/* This loop is added to create multiple /* This loop is added to create multiple
* events depend on count value and add * events depend on count value and add
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/rbtree.h> #include <linux/rbtree.h>
#include <stdbool.h> #include <stdbool.h>
#include "pmu-events/pmu-events.h"
struct evsel; struct evsel;
struct evlist; struct evlist;
...@@ -52,6 +53,6 @@ int metricgroup__parse_groups_test(struct evlist *evlist, ...@@ -52,6 +53,6 @@ int metricgroup__parse_groups_test(struct evlist *evlist,
void metricgroup__print(bool metrics, bool groups, char *filter, void metricgroup__print(bool metrics, bool groups, char *filter,
bool raw, bool details); bool raw, bool details);
bool metricgroup__has_metric(const char *metric); 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); void metricgroup__rblist_exit(struct rblist *metric_events);
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册