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

perf tools: Change parse_events_add_pmu interface

Changing parse_events_add_pmu interface to allow propagating of the
parse_events_error info.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1429729824-13932-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
36adec85 c056ba6a

+12 -10
+6 -5
tools/perf/util/parse-events.c
··· 633 633 return NULL; 634 634 } 635 635 636 - int parse_events_add_pmu(struct list_head *list, int *idx, 637 - char *name, struct list_head *head_config) 636 + int parse_events_add_pmu(struct parse_events_evlist *data, 637 + struct list_head *list, char *name, 638 + struct list_head *head_config) 638 639 { 639 640 struct perf_event_attr attr; 640 641 struct perf_pmu_info info; ··· 655 654 656 655 if (!head_config) { 657 656 attr.type = pmu->type; 658 - evsel = __add_event(list, idx, &attr, NULL, pmu->cpus); 657 + evsel = __add_event(list, &data->idx, &attr, NULL, pmu->cpus); 659 658 return evsel ? 0 : -ENOMEM; 660 659 } 661 660 ··· 672 671 if (perf_pmu__config(pmu, &attr, head_config)) 673 672 return -EINVAL; 674 673 675 - evsel = __add_event(list, idx, &attr, pmu_event_name(head_config), 676 - pmu->cpus); 674 + evsel = __add_event(list, &data->idx, &attr, 675 + pmu_event_name(head_config), pmu->cpus); 677 676 if (evsel) { 678 677 evsel->unit = info.unit; 679 678 evsel->scale = info.scale;
+3 -2
tools/perf/util/parse-events.h
··· 115 115 char *type, char *op_result1, char *op_result2); 116 116 int parse_events_add_breakpoint(struct list_head *list, int *idx, 117 117 void *ptr, char *type, u64 len); 118 - int parse_events_add_pmu(struct list_head *list, int *idx, 119 - char *pmu , struct list_head *head_config); 118 + int parse_events_add_pmu(struct parse_events_evlist *data, 119 + struct list_head *list, char *name, 120 + struct list_head *head_config); 120 121 enum perf_pmu_event_symbol_type 121 122 perf_pmu__parse_check(const char *name); 122 123 void parse_events__set_leader(char *name, struct list_head *list);
+3 -3
tools/perf/util/parse-events.y
··· 207 207 struct list_head *list; 208 208 209 209 ALLOC_LIST(list); 210 - ABORT_ON(parse_events_add_pmu(list, &data->idx, $1, $3)); 210 + ABORT_ON(parse_events_add_pmu(data, list, $1, $3)); 211 211 parse_events__free_terms($3); 212 212 $$ = list; 213 213 } ··· 218 218 struct list_head *list; 219 219 220 220 ALLOC_LIST(list); 221 - ABORT_ON(parse_events_add_pmu(list, &data->idx, $1, NULL)); 221 + ABORT_ON(parse_events_add_pmu(data, list, $1, NULL)); 222 222 $$ = list; 223 223 } 224 224 | ··· 235 235 list_add_tail(&term->list, head); 236 236 237 237 ALLOC_LIST(list); 238 - ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head)); 238 + ABORT_ON(parse_events_add_pmu(data, list, "cpu", head)); 239 239 parse_events__free_terms(head); 240 240 $$ = list; 241 241 }