diff options
| author | He Kuang <hekuang@huawei.com> | 2015-09-27 23:52:15 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-09-28 16:29:38 -0400 |
| commit | 865582c3f48e12b7ab9e260161868313e4a37f44 (patch) | |
| tree | f87a889923ea4e024a5e6c2914b9214bac56f825 /tools | |
| parent | ffeb883e5662e94b14948078e85812261277ad67 (diff) | |
perf tools: Adds the tracepoint name parsing support
Adds rules for parsing tracepoint names. Change rules of tracepoint which
derives from PE_NAMEs into tracepoint names directly, so adding more rules
based on tracepoint names will be easier.
Changes v2-v3:
- Change __event_legacy_tracepoint label in bison file to tracepoint_name
- Fix formats error.
Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1443412336-120050-3-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/perf/util/parse-events.y | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index 8bcc45868457..1c598c2f8dfc 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y | |||
| @@ -67,6 +67,7 @@ static inc_group_count(struct list_head *list, | |||
| 67 | %type <head> event_legacy_cache | 67 | %type <head> event_legacy_cache |
| 68 | %type <head> event_legacy_mem | 68 | %type <head> event_legacy_mem |
| 69 | %type <head> event_legacy_tracepoint | 69 | %type <head> event_legacy_tracepoint |
| 70 | %type <tracepoint_name> tracepoint_name | ||
| 70 | %type <head> event_legacy_numeric | 71 | %type <head> event_legacy_numeric |
| 71 | %type <head> event_legacy_raw | 72 | %type <head> event_legacy_raw |
| 72 | %type <head> event_def | 73 | %type <head> event_def |
| @@ -84,6 +85,10 @@ static inc_group_count(struct list_head *list, | |||
| 84 | u64 num; | 85 | u64 num; |
| 85 | struct list_head *head; | 86 | struct list_head *head; |
| 86 | struct parse_events_term *term; | 87 | struct parse_events_term *term; |
| 88 | struct tracepoint_name { | ||
| 89 | char *sys; | ||
| 90 | char *event; | ||
| 91 | } tracepoint_name; | ||
| 87 | } | 92 | } |
| 88 | %% | 93 | %% |
| 89 | 94 | ||
| @@ -368,36 +373,40 @@ PE_PREFIX_MEM PE_VALUE sep_dc | |||
| 368 | } | 373 | } |
| 369 | 374 | ||
| 370 | event_legacy_tracepoint: | 375 | event_legacy_tracepoint: |
| 371 | PE_NAME '-' PE_NAME ':' PE_NAME | 376 | tracepoint_name |
| 372 | { | 377 | { |
| 373 | struct parse_events_evlist *data = _data; | 378 | struct parse_events_evlist *data = _data; |
| 374 | struct parse_events_error *error = data->error; | 379 | struct parse_events_error *error = data->error; |
| 375 | struct list_head *list; | 380 | struct list_head *list; |
| 376 | char sys_name[128]; | ||
| 377 | snprintf(&sys_name, 128, "%s-%s", $1, $3); | ||
| 378 | 381 | ||
| 379 | ALLOC_LIST(list); | 382 | ALLOC_LIST(list); |
| 380 | if (parse_events_add_tracepoint(list, &data->idx, &sys_name, $5, error)) { | 383 | if (parse_events_add_tracepoint(list, &data->idx, $1.sys, $1.event, |
| 384 | error)) { | ||
| 381 | if (error) | 385 | if (error) |
| 382 | error->idx = @1.first_column; | 386 | error->idx = @1.first_column; |
| 383 | return -1; | 387 | return -1; |
| 384 | } | 388 | } |
| 385 | $$ = list; | 389 | $$ = list; |
| 386 | } | 390 | } |
| 391 | |||
| 392 | tracepoint_name: | ||
| 393 | PE_NAME '-' PE_NAME ':' PE_NAME | ||
| 394 | { | ||
| 395 | char sys_name[128]; | ||
| 396 | struct tracepoint_name tracepoint; | ||
| 397 | |||
| 398 | snprintf(&sys_name, 128, "%s-%s", $1, $3); | ||
| 399 | tracepoint.sys = &sys_name; | ||
| 400 | tracepoint.event = $5; | ||
| 401 | |||
| 402 | $$ = tracepoint; | ||
| 403 | } | ||
| 387 | | | 404 | | |
| 388 | PE_NAME ':' PE_NAME | 405 | PE_NAME ':' PE_NAME |
| 389 | { | 406 | { |
| 390 | struct parse_events_evlist *data = _data; | 407 | struct tracepoint_name tracepoint = {$1, $3}; |
| 391 | struct parse_events_error *error = data->error; | ||
| 392 | struct list_head *list; | ||
| 393 | 408 | ||
| 394 | ALLOC_LIST(list); | 409 | $$ = tracepoint; |
| 395 | if (parse_events_add_tracepoint(list, &data->idx, $1, $3, error)) { | ||
| 396 | if (error) | ||
| 397 | error->idx = @1.first_column; | ||
| 398 | return -1; | ||
| 399 | } | ||
| 400 | $$ = list; | ||
| 401 | } | 410 | } |
| 402 | 411 | ||
| 403 | event_legacy_numeric: | 412 | event_legacy_numeric: |
