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

perf stat,jevents: Introduce Default tags for the default mode

Introduce a new metricgroup, Default, to tag all the metric groups which
will be collected in the default mode.

Add a new field, DefaultMetricgroupName, in the JSON file to indicate
the real metric group name. It will be printed in the default output
to replace the event names.

There is nothing changed for the output format.

On SPR, both TopdownL1 and TopdownL2 are displayed in the default
output.

On ARM, Intel ICL and later platforms (before SPR), only TopdownL1 is
displayed in the default output.

Suggested-by: Stephane Eranian <eranian@google.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ahmad Yasin <ahmad.yasin@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230615135315.3662428-4-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Kan Liang and committed by
Arnaldo Carvalho de Melo
b0a9e8f8 969a4661

+12 -4
+2 -2
tools/perf/builtin-stat.c
··· 2154 2154 * Add TopdownL1 metrics if they exist. To minimize 2155 2155 * multiplexing, don't request threshold computation. 2156 2156 */ 2157 - if (metricgroup__has_metric(pmu, "TopdownL1")) { 2157 + if (metricgroup__has_metric(pmu, "Default")) { 2158 2158 struct evlist *metric_evlist = evlist__new(); 2159 2159 struct evsel *metric_evsel; 2160 2160 2161 2161 if (!metric_evlist) 2162 2162 return -1; 2163 2163 2164 - if (metricgroup__parse_groups(metric_evlist, pmu, "TopdownL1", 2164 + if (metricgroup__parse_groups(metric_evlist, pmu, "Default", 2165 2165 /*metric_no_group=*/false, 2166 2166 /*metric_no_merge=*/false, 2167 2167 /*metric_no_threshold=*/true,
+3 -2
tools/perf/pmu-events/jevents.py
··· 54 54 # Attributes that are in pmu_metric rather than pmu_event. 55 55 _json_metric_attributes = [ 56 56 'pmu', 'metric_name', 'metric_group', 'metric_expr', 'metric_threshold', 57 - 'desc', 'long_desc', 'unit', 'compat', 'metricgroup_no_group', 'aggr_mode', 58 - 'event_grouping' 57 + 'desc', 'long_desc', 'unit', 'compat', 'metricgroup_no_group', 58 + 'default_metricgroup_name', 'aggr_mode', 'event_grouping' 59 59 ] 60 60 # Attributes that are bools or enum int values, encoded as '0', '1',... 61 61 _json_enum_attributes = ['aggr_mode', 'deprecated', 'event_grouping', 'perpkg'] ··· 307 307 self.metric_name = jd.get('MetricName') 308 308 self.metric_group = jd.get('MetricGroup') 309 309 self.metricgroup_no_group = jd.get('MetricgroupNoGroup') 310 + self.default_metricgroup_name = jd.get('DefaultMetricgroupName') 310 311 self.event_grouping = convert_metric_constraint(jd.get('MetricConstraint')) 311 312 self.metric_expr = None 312 313 if 'MetricExpr' in jd:
+1
tools/perf/pmu-events/pmu-events.h
··· 61 61 const char *desc; 62 62 const char *long_desc; 63 63 const char *metricgroup_no_group; 64 + const char *default_metricgroup_name; 64 65 enum aggr_mode_class aggr_mode; 65 66 enum metric_event_groups event_grouping; 66 67 };
+6
tools/perf/util/metricgroup.c
··· 137 137 * output. 138 138 */ 139 139 const char *metric_unit; 140 + /** 141 + * Optional name of the metric group reported 142 + * if the Default metric group is being processed. 143 + */ 144 + const char *default_metricgroup_name; 140 145 /** Optional null terminated array of referenced metrics. */ 141 146 struct metric_ref *metric_refs; 142 147 /** ··· 224 219 225 220 m->pmu = pm->pmu ?: "cpu"; 226 221 m->metric_name = pm->metric_name; 222 + m->default_metricgroup_name = pm->default_metricgroup_name; 227 223 m->modifier = NULL; 228 224 if (modifier) { 229 225 m->modifier = strdup(modifier);