perf pmu-events: Don't assume pmu_event is an array
The current code assumes that a struct pmu_event can be iterated over forward until a NULL pmu_event is encountered. This makes it difficult to refactor pmu_event. Add a loop function taking a callback function that's passed the struct pmu_event. This way the pmu_event is only needed for one element and not an entire array. Switch existing code iterating over the pmu_event arrays to use the new loop function pmu_events_table_for_each_event. Signed-off-by:Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.garry@huawei.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Stephane Eranian <eranian@google.com> Cc: Will Deacon <will@kernel.org> Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com> Cc: linux-arm-kernel@lists.infradead.org Link: https://lore.kernel.org/r/20220812230949.683239-11-irogers@google.com Signed-off-by:
Arnaldo Carvalho de Melo <acme@redhat.com>
Showing
- tools/perf/pmu-events/empty-pmu-events.c 20 additions, 14 deletionstools/perf/pmu-events/empty-pmu-events.c
- tools/perf/pmu-events/jevents.py 20 additions, 14 deletionstools/perf/pmu-events/jevents.py
- tools/perf/pmu-events/pmu-events.h 3 additions, 0 deletionstools/perf/pmu-events/pmu-events.h
- tools/perf/tests/pmu-events.c 78 additions, 58 deletionstools/perf/tests/pmu-events.c
- tools/perf/util/metricgroup.c 125 additions, 56 deletionstools/perf/util/metricgroup.c
- tools/perf/util/pmu.c 37 additions, 28 deletionstools/perf/util/pmu.c
- tools/perf/util/s390-sample-raw.c 30 additions, 12 deletionstools/perf/util/s390-sample-raw.c
Loading
Please register or sign in to comment