aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/parse-events.c
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2014-09-24 10:04:06 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-09-29 14:03:57 -0400
commit46441bdc76fee08e297ebcf17e4ca91013b1ee9e (patch)
tree21787b6918ed42578cf673d284d119585bfb6ace /tools/perf/util/parse-events.c
parent07394b5f13a04f86b27e0ddd96a36c7d9bfe1a4f (diff)
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>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r--tools/perf/util/parse-events.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 61be3e695ec2..9522cf22ad81 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -634,10 +634,9 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
634 char *name, struct list_head *head_config) 634 char *name, struct list_head *head_config)
635{ 635{
636 struct perf_event_attr attr; 636 struct perf_event_attr attr;
637 struct perf_pmu_info info;
637 struct perf_pmu *pmu; 638 struct perf_pmu *pmu;
638 struct perf_evsel *evsel; 639 struct perf_evsel *evsel;
639 const char *unit;
640 double scale;
641 640
642 pmu = perf_pmu__find(name); 641 pmu = perf_pmu__find(name);
643 if (!pmu) 642 if (!pmu)
@@ -656,7 +655,7 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
656 return evsel ? 0 : -ENOMEM; 655 return evsel ? 0 : -ENOMEM;
657 } 656 }
658 657
659 if (perf_pmu__check_alias(pmu, head_config, &unit, &scale)) 658 if (perf_pmu__check_alias(pmu, head_config, &info))
660 return -EINVAL; 659 return -EINVAL;
661 660
662 /* 661 /*
@@ -671,8 +670,8 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
671 evsel = __add_event(list, idx, &attr, pmu_event_name(head_config), 670 evsel = __add_event(list, idx, &attr, pmu_event_name(head_config),
672 pmu->cpus); 671 pmu->cpus);
673 if (evsel) { 672 if (evsel) {
674 evsel->unit = unit; 673 evsel->unit = info.unit;
675 evsel->scale = scale; 674 evsel->scale = info.scale;
676 } 675 }
677 676
678 return evsel ? 0 : -ENOMEM; 677 return evsel ? 0 : -ENOMEM;