diff options
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r-- | tools/perf/util/parse-events.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 59324e7b3d8e..fac7d59309b8 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -634,6 +634,9 @@ do { \ | |||
634 | * attr->branch_sample_type = term->val.num; | 634 | * attr->branch_sample_type = term->val.num; |
635 | */ | 635 | */ |
636 | break; | 636 | break; |
637 | case PARSE_EVENTS__TERM_TYPE_NAME: | ||
638 | CHECK_TYPE_VAL(STR); | ||
639 | break; | ||
637 | default: | 640 | default: |
638 | return -EINVAL; | 641 | return -EINVAL; |
639 | } | 642 | } |
@@ -672,6 +675,23 @@ int parse_events_add_numeric(struct list_head **list, int *idx, | |||
672 | (char *) __event_name(type, config)); | 675 | (char *) __event_name(type, config)); |
673 | } | 676 | } |
674 | 677 | ||
678 | static int parse_events__is_name_term(struct parse_events__term *term) | ||
679 | { | ||
680 | return term->type_term == PARSE_EVENTS__TERM_TYPE_NAME; | ||
681 | } | ||
682 | |||
683 | static char *pmu_event_name(struct perf_event_attr *attr, | ||
684 | struct list_head *head_terms) | ||
685 | { | ||
686 | struct parse_events__term *term; | ||
687 | |||
688 | list_for_each_entry(term, head_terms, list) | ||
689 | if (parse_events__is_name_term(term)) | ||
690 | return term->val.str; | ||
691 | |||
692 | return (char *) __event_name(PERF_TYPE_RAW, attr->config); | ||
693 | } | ||
694 | |||
675 | int parse_events_add_pmu(struct list_head **list, int *idx, | 695 | int parse_events_add_pmu(struct list_head **list, int *idx, |
676 | char *name, struct list_head *head_config) | 696 | char *name, struct list_head *head_config) |
677 | { | 697 | { |
@@ -693,7 +713,8 @@ int parse_events_add_pmu(struct list_head **list, int *idx, | |||
693 | if (perf_pmu__config(pmu, &attr, head_config)) | 713 | if (perf_pmu__config(pmu, &attr, head_config)) |
694 | return -EINVAL; | 714 | return -EINVAL; |
695 | 715 | ||
696 | return add_event(list, idx, &attr, (char *) "pmu"); | 716 | return add_event(list, idx, &attr, |
717 | pmu_event_name(&attr, head_config)); | ||
697 | } | 718 | } |
698 | 719 | ||
699 | void parse_events_update_lists(struct list_head *list_event, | 720 | void parse_events_update_lists(struct list_head *list_event, |