mirror of
https://github.com/torvalds/linux.git
synced 2026-11-29 18:12:48 +00:00
perf evsel: Add function to compute group PMU name
The computed name respects software events and aux event groups, such that the pmu_name is changed to be that of the aux event leader or group leader for software events. This is done as a later change will split events that are in different PMUs into different groups. Committer notes: Added a stub for this new function so that 'perf test python' passes. Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Florian Fischer <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kim Phillips <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Steinar H. Gunderson <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Suzuki Poulouse <[email protected]> Cc: Xing Zhengjun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
c6d616fe10
commit
7abf0bccaa
@@ -821,6 +821,30 @@ out_unknown:
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
const char *evsel__group_pmu_name(const struct evsel *evsel)
|
||||
{
|
||||
const struct evsel *leader;
|
||||
|
||||
/* If the pmu_name is set use it. pmu_name isn't set for CPU and software events. */
|
||||
if (evsel->pmu_name)
|
||||
return evsel->pmu_name;
|
||||
/*
|
||||
* Software events may be in a group with other uncore PMU events. Use
|
||||
* the pmu_name of the group leader to avoid breaking the software event
|
||||
* out of the group.
|
||||
*
|
||||
* Aux event leaders, like intel_pt, expect a group with events from
|
||||
* other PMUs, so substitute the AUX event's PMU in this case.
|
||||
*/
|
||||
leader = evsel__leader(evsel);
|
||||
if ((evsel->core.attr.type == PERF_TYPE_SOFTWARE || evsel__is_aux_event(leader)) &&
|
||||
leader->pmu_name) {
|
||||
return leader->pmu_name;
|
||||
}
|
||||
|
||||
return "cpu";
|
||||
}
|
||||
|
||||
const char *evsel__metric_id(const struct evsel *evsel)
|
||||
{
|
||||
if (evsel->metric_id)
|
||||
|
||||
@@ -280,6 +280,7 @@ int arch_evsel__hw_name(struct evsel *evsel, char *bf, size_t size);
|
||||
|
||||
int __evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, char *bf, size_t size);
|
||||
const char *evsel__name(struct evsel *evsel);
|
||||
const char *evsel__group_pmu_name(const struct evsel *evsel);
|
||||
const char *evsel__metric_id(const struct evsel *evsel);
|
||||
|
||||
static inline bool evsel__is_tool(const struct evsel *evsel)
|
||||
|
||||
@@ -93,6 +93,11 @@ int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt,
|
||||
return EOF;
|
||||
}
|
||||
|
||||
bool evsel__is_aux_event(const struct evsel *evsel __maybe_unused)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add this one here not to drag util/metricgroup.c
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user