Skip to content

Commit 1233616

Browse files
captain5050acmel
authored andcommitted
perf evsel: Modify group pmu name for software events
If we have a group of {cycles,faults} then we need the faults software event to appear to be on the same PMU as cycles so that we don't split the group in parse_events__sort_events_and_fix_groups. This case is relatively easy as cycles is the leader and will have a PMU name. In the reverse case, {faults,cycles} we still need faults to appear to have the PMU name of cycles but the old behavior is just to return "cpu". For hybrid this fails as cycles will be on "cpu_core" or "cpu_atom", causing faults to be split into a different group. Change the behavior for software events so that the whole group is searched for the named PMU. Signed-off-by: Ian Rogers <[email protected]> Tested-by: Adrian Hunter <[email protected]> Cc: Ahmad Yasin <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Athira Rajeev <[email protected]> Cc: Caleb Biggers <[email protected]> Cc: Edward Baker <[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: Kang Minchul <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Perry Taylor <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: Rob Herring <[email protected]> Cc: Samantha Alt <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Suzuki Poulouse <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Tiezhu Yang <[email protected]> Cc: Weilin Wang <[email protected]> Cc: Xing Zhengjun <[email protected]> Cc: Yang Jihong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 34e8289 commit 1233616

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tools/perf/util/evsel.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -829,23 +829,26 @@ bool evsel__name_is(struct evsel *evsel, const char *name)
829829

830830
const char *evsel__group_pmu_name(const struct evsel *evsel)
831831
{
832-
const struct evsel *leader;
832+
struct evsel *leader, *pos;
833833

834834
/* If the pmu_name is set use it. pmu_name isn't set for CPU and software events. */
835835
if (evsel->pmu_name)
836836
return evsel->pmu_name;
837837
/*
838838
* Software events may be in a group with other uncore PMU events. Use
839-
* the pmu_name of the group leader to avoid breaking the software event
840-
* out of the group.
839+
* the pmu_name of the first non-software event to avoid breaking the
840+
* software event out of the group.
841841
*
842842
* Aux event leaders, like intel_pt, expect a group with events from
843843
* other PMUs, so substitute the AUX event's PMU in this case.
844844
*/
845845
leader = evsel__leader(evsel);
846-
if ((evsel->core.attr.type == PERF_TYPE_SOFTWARE || evsel__is_aux_event(leader)) &&
847-
leader->pmu_name) {
848-
return leader->pmu_name;
846+
if (evsel->core.attr.type == PERF_TYPE_SOFTWARE || evsel__is_aux_event(leader)) {
847+
/* Starting with the leader, find the first event with a named PMU. */
848+
for_each_group_evsel(pos, leader) {
849+
if (pos->pmu_name)
850+
return pos->pmu_name;
851+
}
849852
}
850853

851854
return "cpu";

0 commit comments

Comments
 (0)