diff options
| -rw-r--r-- | tools/perf/util/parse-events.c | 61 | ||||
| -rw-r--r-- | tools/perf/util/parse-events.h | 1 |
2 files changed, 6 insertions, 56 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 517e6473982c..eacf932a36a0 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
| @@ -161,24 +161,6 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config) | |||
| 161 | return NULL; | 161 | return NULL; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | #define TP_PATH_LEN (MAX_EVENT_LENGTH * 2 + 1) | ||
| 165 | static const char *tracepoint_id_to_name(u64 config) | ||
| 166 | { | ||
| 167 | static char buf[TP_PATH_LEN]; | ||
| 168 | struct tracepoint_path *path; | ||
| 169 | |||
| 170 | path = tracepoint_id_to_path(config); | ||
| 171 | if (path) { | ||
| 172 | snprintf(buf, TP_PATH_LEN, "%s:%s", path->system, path->name); | ||
| 173 | free(path->name); | ||
| 174 | free(path->system); | ||
| 175 | free(path); | ||
| 176 | } else | ||
| 177 | snprintf(buf, TP_PATH_LEN, "%s:%s", "unknown", "unknown"); | ||
| 178 | |||
| 179 | return buf; | ||
| 180 | } | ||
| 181 | |||
| 182 | const char *event_type(int type) | 164 | const char *event_type(int type) |
| 183 | { | 165 | { |
| 184 | switch (type) { | 166 | switch (type) { |
| @@ -201,36 +183,6 @@ const char *event_type(int type) | |||
| 201 | return "unknown"; | 183 | return "unknown"; |
| 202 | } | 184 | } |
| 203 | 185 | ||
| 204 | const char *__event_name(int type, u64 config) | ||
| 205 | { | ||
| 206 | static char buf[32]; | ||
| 207 | |||
| 208 | if (type == PERF_TYPE_RAW) { | ||
| 209 | sprintf(buf, "raw 0x%" PRIx64, config); | ||
| 210 | return buf; | ||
| 211 | } | ||
| 212 | |||
| 213 | switch (type) { | ||
| 214 | case PERF_TYPE_HARDWARE: | ||
| 215 | return __perf_evsel__hw_name(config); | ||
| 216 | |||
| 217 | case PERF_TYPE_HW_CACHE: | ||
| 218 | __perf_evsel__hw_cache_name(config, buf, sizeof(buf)); | ||
| 219 | return buf; | ||
| 220 | |||
| 221 | case PERF_TYPE_SOFTWARE: | ||
| 222 | return __perf_evsel__sw_name(config); | ||
| 223 | |||
| 224 | case PERF_TYPE_TRACEPOINT: | ||
| 225 | return tracepoint_id_to_name(config); | ||
| 226 | |||
| 227 | default: | ||
| 228 | break; | ||
| 229 | } | ||
| 230 | |||
| 231 | return "unknown"; | ||
| 232 | } | ||
| 233 | |||
| 234 | static int add_event(struct list_head **_list, int *idx, | 186 | static int add_event(struct list_head **_list, int *idx, |
| 235 | struct perf_event_attr *attr, char *name) | 187 | struct perf_event_attr *attr, char *name) |
| 236 | { | 188 | { |
| @@ -252,7 +204,8 @@ static int add_event(struct list_head **_list, int *idx, | |||
| 252 | return -ENOMEM; | 204 | return -ENOMEM; |
| 253 | } | 205 | } |
| 254 | 206 | ||
| 255 | evsel->name = strdup(name); | 207 | if (name) |
| 208 | evsel->name = strdup(name); | ||
| 256 | list_add_tail(&evsel->node, list); | 209 | list_add_tail(&evsel->node, list); |
| 257 | *_list = list; | 210 | *_list = list; |
| 258 | return 0; | 211 | return 0; |
| @@ -545,8 +498,7 @@ int parse_events_add_numeric(struct list_head **list, int *idx, | |||
| 545 | config_attr(&attr, head_config, 1)) | 498 | config_attr(&attr, head_config, 1)) |
| 546 | return -EINVAL; | 499 | return -EINVAL; |
| 547 | 500 | ||
| 548 | return add_event(list, idx, &attr, | 501 | return add_event(list, idx, &attr, NULL); |
| 549 | (char *) __event_name(type, config)); | ||
| 550 | } | 502 | } |
| 551 | 503 | ||
| 552 | static int parse_events__is_name_term(struct parse_events__term *term) | 504 | static int parse_events__is_name_term(struct parse_events__term *term) |
| @@ -554,8 +506,7 @@ static int parse_events__is_name_term(struct parse_events__term *term) | |||
| 554 | return term->type_term == PARSE_EVENTS__TERM_TYPE_NAME; | 506 | return term->type_term == PARSE_EVENTS__TERM_TYPE_NAME; |
| 555 | } | 507 | } |
| 556 | 508 | ||
| 557 | static char *pmu_event_name(struct perf_event_attr *attr, | 509 | static char *pmu_event_name(struct list_head *head_terms) |
| 558 | struct list_head *head_terms) | ||
| 559 | { | 510 | { |
| 560 | struct parse_events__term *term; | 511 | struct parse_events__term *term; |
| 561 | 512 | ||
| @@ -563,7 +514,7 @@ static char *pmu_event_name(struct perf_event_attr *attr, | |||
| 563 | if (parse_events__is_name_term(term)) | 514 | if (parse_events__is_name_term(term)) |
| 564 | return term->val.str; | 515 | return term->val.str; |
| 565 | 516 | ||
| 566 | return (char *) __event_name(PERF_TYPE_RAW, attr->config); | 517 | return NULL; |
| 567 | } | 518 | } |
| 568 | 519 | ||
| 569 | int parse_events_add_pmu(struct list_head **list, int *idx, | 520 | int parse_events_add_pmu(struct list_head **list, int *idx, |
| @@ -588,7 +539,7 @@ int parse_events_add_pmu(struct list_head **list, int *idx, | |||
| 588 | return -EINVAL; | 539 | return -EINVAL; |
| 589 | 540 | ||
| 590 | return add_event(list, idx, &attr, | 541 | return add_event(list, idx, &attr, |
| 591 | pmu_event_name(&attr, head_config)); | 542 | pmu_event_name(head_config)); |
| 592 | } | 543 | } |
| 593 | 544 | ||
| 594 | void parse_events_update_lists(struct list_head *list_event, | 545 | void parse_events_update_lists(struct list_head *list_event, |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index d7eb070937c4..1784f06e3a6a 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
| @@ -26,7 +26,6 @@ extern struct tracepoint_path *tracepoint_id_to_path(u64 config); | |||
| 26 | extern bool have_tracepoints(struct list_head *evlist); | 26 | extern bool have_tracepoints(struct list_head *evlist); |
| 27 | 27 | ||
| 28 | const char *event_type(int type); | 28 | const char *event_type(int type); |
| 29 | extern const char *__event_name(int type, u64 config); | ||
| 30 | 29 | ||
| 31 | extern int parse_events_option(const struct option *opt, const char *str, | 30 | extern int parse_events_option(const struct option *opt, const char *str, |
| 32 | int unset); | 31 | int unset); |
