perf tools: Refactor unit and scale function parameters
Passing pointers to alias modifiers 'unit' and 'scale' isn't very future-proof since if we add more modifiers to the list we'll end up passing more arguments. Instead wrap everything up in a struct perf_pmu_info, which can easily be expanded when additional alias modifiers are necessary in the future. Signed-off-by: Matt Fleming <matt.fleming@intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1411567455-31264-3-git-send-email-matt@console-pimps.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
07394b5f13
commit
46441bdc76
@@ -634,10 +634,9 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
|
||||
char *name, struct list_head *head_config)
|
||||
{
|
||||
struct perf_event_attr attr;
|
||||
struct perf_pmu_info info;
|
||||
struct perf_pmu *pmu;
|
||||
struct perf_evsel *evsel;
|
||||
const char *unit;
|
||||
double scale;
|
||||
|
||||
pmu = perf_pmu__find(name);
|
||||
if (!pmu)
|
||||
@@ -656,7 +655,7 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
|
||||
return evsel ? 0 : -ENOMEM;
|
||||
}
|
||||
|
||||
if (perf_pmu__check_alias(pmu, head_config, &unit, &scale))
|
||||
if (perf_pmu__check_alias(pmu, head_config, &info))
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
@@ -671,8 +670,8 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
|
||||
evsel = __add_event(list, idx, &attr, pmu_event_name(head_config),
|
||||
pmu->cpus);
|
||||
if (evsel) {
|
||||
evsel->unit = unit;
|
||||
evsel->scale = scale;
|
||||
evsel->unit = info.unit;
|
||||
evsel->scale = info.scale;
|
||||
}
|
||||
|
||||
return evsel ? 0 : -ENOMEM;
|
||||
|
Reference in New Issue
Block a user