Skip to content

Commit d0192fd

Browse files
olsajiriacmel
authored andcommitted
perf stat: Move 'metric_events' to 'struct perf_stat_config'
Move the static variable 'metric_events' to 'struct perf_stat_config', so that it can be passed around and used outside 'perf stat' command. Signed-off-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: David Ahern <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 54ac0b1 commit d0192fd

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

tools/perf/builtin-stat.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ static const char *smi_cost_attrs = {
137137

138138
static struct perf_evlist *evsel_list;
139139

140-
static struct rblist metric_events;
141-
142140
static struct target target = {
143141
.uid = UINT_MAX,
144142
};
@@ -1082,7 +1080,7 @@ static void printout(struct perf_stat_config *config, int id, int nr,
10821080

10831081
perf_stat__print_shadow_stats(config, counter, uval,
10841082
first_shadow_cpu(config, counter, id),
1085-
&out, &metric_events, st);
1083+
&out, &config->metric_events, st);
10861084
if (!config->csv_output && !config->metric_only) {
10871085
print_noise(config, counter, noise);
10881086
print_running(config, run, ena);
@@ -1533,7 +1531,7 @@ static void print_metric_headers(struct perf_stat_config *config,
15331531
perf_stat__print_shadow_stats(config, counter, 0,
15341532
0,
15351533
&out,
1536-
&metric_events,
1534+
&config->metric_events,
15371535
&rt_stat);
15381536
}
15391537
fputc('\n', config->output);
@@ -1860,7 +1858,7 @@ static int parse_metric_groups(const struct option *opt,
18601858
const char *str,
18611859
int unset __maybe_unused)
18621860
{
1863-
return metricgroup__parse_groups(opt, str, &metric_events);
1861+
return metricgroup__parse_groups(opt, str, &stat_config.metric_events);
18641862
}
18651863

18661864
static const struct option stat_options[] = {
@@ -2321,7 +2319,7 @@ static int add_default_attributes(void)
23212319
struct option opt = { .value = &evsel_list };
23222320

23232321
return metricgroup__parse_groups(&opt, "transaction",
2324-
&metric_events);
2322+
&stat_config.metric_events);
23252323
}
23262324

23272325
if (pmu_have_event("cpu", "cycles-ct") &&

tools/perf/util/stat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ struct perf_stat_config {
125125
aggr_get_id_t aggr_get_id;
126126
struct cpu_map *cpus_aggr_map;
127127
u64 *walltime_run;
128+
struct rblist metric_events;
128129
};
129130

130131
void update_stats(struct stats *stats, u64 val);

0 commit comments

Comments
 (0)