mirror of https://gitee.com/openkylin/linux.git
perf tools: Add location to pmu event terms
Saving the terms location within term struct, so it could be used later for report. 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-6-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
36adec85a8
commit
cecf3a2e18
|
@ -25,6 +25,12 @@
|
|||
extern int parse_events_debug;
|
||||
#endif
|
||||
int parse_events_parse(void *data, void *scanner);
|
||||
int parse_events_term__num(struct parse_events_term **term,
|
||||
int type_term, char *config, u64 num,
|
||||
YYLTYPE *loc_term, YYLTYPE *loc_val);
|
||||
int parse_events_term__str(struct parse_events_term **term,
|
||||
int type_term, char *config, char *str,
|
||||
YYLTYPE *loc_term, YYLTYPE *loc_val);
|
||||
|
||||
static struct perf_pmu_event_symbol *perf_pmu_events_list;
|
||||
/*
|
||||
|
@ -1542,7 +1548,7 @@ int parse_events__is_hardcoded_term(struct parse_events_term *term)
|
|||
|
||||
static int new_term(struct parse_events_term **_term, int type_val,
|
||||
int type_term, char *config,
|
||||
char *str, u64 num)
|
||||
char *str, u64 num, int err_term, int err_val)
|
||||
{
|
||||
struct parse_events_term *term;
|
||||
|
||||
|
@ -1554,6 +1560,8 @@ static int new_term(struct parse_events_term **_term, int type_val,
|
|||
term->type_val = type_val;
|
||||
term->type_term = type_term;
|
||||
term->config = config;
|
||||
term->err_term = err_term;
|
||||
term->err_val = err_val;
|
||||
|
||||
switch (type_val) {
|
||||
case PARSE_EVENTS__TERM_TYPE_NUM:
|
||||
|
@ -1572,17 +1580,23 @@ static int new_term(struct parse_events_term **_term, int type_val,
|
|||
}
|
||||
|
||||
int parse_events_term__num(struct parse_events_term **term,
|
||||
int type_term, char *config, u64 num)
|
||||
int type_term, char *config, u64 num,
|
||||
YYLTYPE *loc_term, YYLTYPE *loc_val)
|
||||
{
|
||||
return new_term(term, PARSE_EVENTS__TERM_TYPE_NUM, type_term,
|
||||
config, NULL, num);
|
||||
config, NULL, num,
|
||||
loc_term ? loc_term->first_column : 0,
|
||||
loc_val ? loc_val->first_column : 0);
|
||||
}
|
||||
|
||||
int parse_events_term__str(struct parse_events_term **term,
|
||||
int type_term, char *config, char *str)
|
||||
int type_term, char *config, char *str,
|
||||
YYLTYPE *loc_term, YYLTYPE *loc_val)
|
||||
{
|
||||
return new_term(term, PARSE_EVENTS__TERM_TYPE_STR, type_term,
|
||||
config, str, 0);
|
||||
config, str, 0,
|
||||
loc_term ? loc_term->first_column : 0,
|
||||
loc_val ? loc_val->first_column : 0);
|
||||
}
|
||||
|
||||
int parse_events_term__sym_hw(struct parse_events_term **term,
|
||||
|
@ -1596,18 +1610,20 @@ int parse_events_term__sym_hw(struct parse_events_term **term,
|
|||
if (config)
|
||||
return new_term(term, PARSE_EVENTS__TERM_TYPE_STR,
|
||||
PARSE_EVENTS__TERM_TYPE_USER, config,
|
||||
(char *) sym->symbol, 0);
|
||||
(char *) sym->symbol, 0, 0, 0);
|
||||
else
|
||||
return new_term(term, PARSE_EVENTS__TERM_TYPE_STR,
|
||||
PARSE_EVENTS__TERM_TYPE_USER,
|
||||
(char *) "event", (char *) sym->symbol, 0);
|
||||
(char *) "event", (char *) sym->symbol,
|
||||
0, 0, 0);
|
||||
}
|
||||
|
||||
int parse_events_term__clone(struct parse_events_term **new,
|
||||
struct parse_events_term *term)
|
||||
{
|
||||
return new_term(new, term->type_val, term->type_term, term->config,
|
||||
term->val.str, term->val.num);
|
||||
term->val.str, term->val.num,
|
||||
term->err_term, term->err_val);
|
||||
}
|
||||
|
||||
void parse_events__free_terms(struct list_head *terms)
|
||||
|
|
|
@ -74,6 +74,10 @@ struct parse_events_term {
|
|||
int type_term;
|
||||
struct list_head list;
|
||||
bool used;
|
||||
|
||||
/* error string indexes for within parsed string */
|
||||
int err_term;
|
||||
int err_val;
|
||||
};
|
||||
|
||||
struct parse_events_error {
|
||||
|
@ -94,10 +98,6 @@ struct parse_events_terms {
|
|||
};
|
||||
|
||||
int parse_events__is_hardcoded_term(struct parse_events_term *term);
|
||||
int parse_events_term__num(struct parse_events_term **_term,
|
||||
int type_term, char *config, u64 num);
|
||||
int parse_events_term__str(struct parse_events_term **_term,
|
||||
int type_term, char *config, char *str);
|
||||
int parse_events_term__sym_hw(struct parse_events_term **term,
|
||||
char *config, unsigned idx);
|
||||
int parse_events_term__clone(struct parse_events_term **new,
|
||||
|
|
|
@ -231,7 +231,7 @@ PE_KERNEL_PMU_EVENT sep_dc
|
|||
|
||||
ALLOC_LIST(head);
|
||||
ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
|
||||
$1, 1));
|
||||
$1, 1, &@1, NULL));
|
||||
list_add_tail(&term->list, head);
|
||||
|
||||
ALLOC_LIST(list);
|
||||
|
@ -251,7 +251,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc
|
|||
|
||||
ALLOC_LIST(head);
|
||||
ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
|
||||
&pmu_name, 1));
|
||||
&pmu_name, 1, &@1, NULL));
|
||||
list_add_tail(&term->list, head);
|
||||
|
||||
ALLOC_LIST(list);
|
||||
|
@ -449,7 +449,7 @@ PE_NAME '=' PE_NAME
|
|||
struct parse_events_term *term;
|
||||
|
||||
ABORT_ON(parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER,
|
||||
$1, $3));
|
||||
$1, $3, &@1, &@3));
|
||||
$$ = term;
|
||||
}
|
||||
|
|
||||
|
@ -458,7 +458,7 @@ PE_NAME '=' PE_VALUE
|
|||
struct parse_events_term *term;
|
||||
|
||||
ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
|
||||
$1, $3));
|
||||
$1, $3, &@1, &@3));
|
||||
$$ = term;
|
||||
}
|
||||
|
|
||||
|
@ -476,7 +476,7 @@ PE_NAME
|
|||
struct parse_events_term *term;
|
||||
|
||||
ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
|
||||
$1, 1));
|
||||
$1, 1, &@1, NULL));
|
||||
$$ = term;
|
||||
}
|
||||
|
|
||||
|
@ -493,7 +493,7 @@ PE_TERM '=' PE_NAME
|
|||
{
|
||||
struct parse_events_term *term;
|
||||
|
||||
ABORT_ON(parse_events_term__str(&term, (int)$1, NULL, $3));
|
||||
ABORT_ON(parse_events_term__str(&term, (int)$1, NULL, $3, &@1, &@3));
|
||||
$$ = term;
|
||||
}
|
||||
|
|
||||
|
@ -501,7 +501,7 @@ PE_TERM '=' PE_VALUE
|
|||
{
|
||||
struct parse_events_term *term;
|
||||
|
||||
ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3));
|
||||
ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3, &@1, &@3));
|
||||
$$ = term;
|
||||
}
|
||||
|
|
||||
|
@ -509,7 +509,7 @@ PE_TERM
|
|||
{
|
||||
struct parse_events_term *term;
|
||||
|
||||
ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1));
|
||||
ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1, &@1, NULL));
|
||||
$$ = term;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue