Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf metricgroup: Don't early exit if no CPUID table exists

The failure to find a table of metrics with a CPUID shouldn't early
exit as the metric code will now also consider the default table.

When searching for a metric or metric group,
pmu_metrics_table__for_each_metric() considers all tables and so the
caller doesn't need to switch the table to do this.

Fixes: c7adeb0974f18da4 ("perf jevents: Add set of common metrics based on default ones")
Reviewed-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Leo Yan <leo.yan@arm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
cee275ed f637bb2e

+5 -13
+5 -13
tools/perf/util/metricgroup.c
··· 1562 1562 { 1563 1563 const struct pmu_metrics_table *table = pmu_metrics_table__find(); 1564 1564 1565 - if (!table) 1566 - return -EINVAL; 1567 1565 if (hardware_aware_grouping) 1568 1566 pr_debug("Use hardware aware grouping instead of traditional metric grouping method\n"); 1569 1567 ··· 1599 1601 1600 1602 bool metricgroup__has_metric_or_groups(const char *pmu, const char *metric_or_groups) 1601 1603 { 1602 - const struct pmu_metrics_table *tables[2] = { 1603 - pmu_metrics_table__find(), 1604 - pmu_metrics_table__default(), 1605 - }; 1604 + const struct pmu_metrics_table *table = pmu_metrics_table__find(); 1606 1605 struct metricgroup__has_metric_data data = { 1607 1606 .pmu = pmu, 1608 1607 .metric_or_groups = metric_or_groups, 1609 1608 }; 1610 1609 1611 - for (size_t i = 0; i < ARRAY_SIZE(tables); i++) { 1612 - if (pmu_metrics_table__for_each_metric(tables[i], 1613 - metricgroup__has_metric_or_groups_callback, 1614 - &data)) 1615 - return true; 1616 - } 1617 - return false; 1610 + return pmu_metrics_table__for_each_metric(table, 1611 + metricgroup__has_metric_or_groups_callback, 1612 + &data) 1613 + ? true : false; 1618 1614 } 1619 1615 1620 1616 static int metricgroup__topdown_max_level_callback(const struct pmu_metric *pm,