Commit 36adec85 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

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: default avatarJiri 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c056ba6a
...@@ -633,8 +633,9 @@ static char *pmu_event_name(struct list_head *head_terms) ...@@ -633,8 +633,9 @@ static char *pmu_event_name(struct list_head *head_terms)
return NULL; return NULL;
} }
int parse_events_add_pmu(struct list_head *list, int *idx, int parse_events_add_pmu(struct parse_events_evlist *data,
char *name, struct list_head *head_config) struct list_head *list, char *name,
struct list_head *head_config)
{ {
struct perf_event_attr attr; struct perf_event_attr attr;
struct perf_pmu_info info; struct perf_pmu_info info;
...@@ -654,7 +655,7 @@ int parse_events_add_pmu(struct list_head *list, int *idx, ...@@ -654,7 +655,7 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
if (!head_config) { if (!head_config) {
attr.type = pmu->type; attr.type = pmu->type;
evsel = __add_event(list, idx, &attr, NULL, pmu->cpus); evsel = __add_event(list, &data->idx, &attr, NULL, pmu->cpus);
return evsel ? 0 : -ENOMEM; return evsel ? 0 : -ENOMEM;
} }
...@@ -671,8 +672,8 @@ int parse_events_add_pmu(struct list_head *list, int *idx, ...@@ -671,8 +672,8 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
if (perf_pmu__config(pmu, &attr, head_config)) if (perf_pmu__config(pmu, &attr, head_config))
return -EINVAL; return -EINVAL;
evsel = __add_event(list, idx, &attr, pmu_event_name(head_config), evsel = __add_event(list, &data->idx, &attr,
pmu->cpus); pmu_event_name(head_config), pmu->cpus);
if (evsel) { if (evsel) {
evsel->unit = info.unit; evsel->unit = info.unit;
evsel->scale = info.scale; evsel->scale = info.scale;
......
...@@ -115,8 +115,9 @@ int parse_events_add_cache(struct list_head *list, int *idx, ...@@ -115,8 +115,9 @@ int parse_events_add_cache(struct list_head *list, int *idx,
char *type, char *op_result1, char *op_result2); char *type, char *op_result1, char *op_result2);
int parse_events_add_breakpoint(struct list_head *list, int *idx, int parse_events_add_breakpoint(struct list_head *list, int *idx,
void *ptr, char *type, u64 len); void *ptr, char *type, u64 len);
int parse_events_add_pmu(struct list_head *list, int *idx, int parse_events_add_pmu(struct parse_events_evlist *data,
char *pmu , struct list_head *head_config); struct list_head *list, char *name,
struct list_head *head_config);
enum perf_pmu_event_symbol_type enum perf_pmu_event_symbol_type
perf_pmu__parse_check(const char *name); perf_pmu__parse_check(const char *name);
void parse_events__set_leader(char *name, struct list_head *list); void parse_events__set_leader(char *name, struct list_head *list);
......
...@@ -207,7 +207,7 @@ PE_NAME '/' event_config '/' ...@@ -207,7 +207,7 @@ PE_NAME '/' event_config '/'
struct list_head *list; struct list_head *list;
ALLOC_LIST(list); ALLOC_LIST(list);
ABORT_ON(parse_events_add_pmu(list, &data->idx, $1, $3)); ABORT_ON(parse_events_add_pmu(data, list, $1, $3));
parse_events__free_terms($3); parse_events__free_terms($3);
$$ = list; $$ = list;
} }
...@@ -218,7 +218,7 @@ PE_NAME '/' '/' ...@@ -218,7 +218,7 @@ PE_NAME '/' '/'
struct list_head *list; struct list_head *list;
ALLOC_LIST(list); ALLOC_LIST(list);
ABORT_ON(parse_events_add_pmu(list, &data->idx, $1, NULL)); ABORT_ON(parse_events_add_pmu(data, list, $1, NULL));
$$ = list; $$ = list;
} }
| |
...@@ -235,7 +235,7 @@ PE_KERNEL_PMU_EVENT sep_dc ...@@ -235,7 +235,7 @@ PE_KERNEL_PMU_EVENT sep_dc
list_add_tail(&term->list, head); list_add_tail(&term->list, head);
ALLOC_LIST(list); ALLOC_LIST(list);
ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head)); ABORT_ON(parse_events_add_pmu(data, list, "cpu", head));
parse_events__free_terms(head); parse_events__free_terms(head);
$$ = list; $$ = list;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment