diff options
Diffstat (limited to 'Documentation/perf_counter')
-rw-r--r-- | Documentation/perf_counter/builtin-report.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c index 6207a3147fcb..a8d390596d8d 100644 --- a/Documentation/perf_counter/builtin-report.c +++ b/Documentation/perf_counter/builtin-report.c | |||
@@ -453,28 +453,18 @@ static int sort_dimension__add(char *tok) | |||
453 | if (sd->taken) | 453 | if (sd->taken) |
454 | continue; | 454 | continue; |
455 | 455 | ||
456 | if (strcmp(tok, sd->name)) | 456 | if (strncasecmp(tok, sd->name, strlen(tok))) |
457 | continue; | 457 | continue; |
458 | 458 | ||
459 | list_add_tail(&sd->entry->list, &hist_entry__sort_list); | 459 | list_add_tail(&sd->entry->list, &hist_entry__sort_list); |
460 | sd->taken = 1; | 460 | sd->taken = 1; |
461 | |||
461 | return 0; | 462 | return 0; |
462 | } | 463 | } |
463 | 464 | ||
464 | return -ESRCH; | 465 | return -ESRCH; |
465 | } | 466 | } |
466 | 467 | ||
467 | static void setup_sorting(void) | ||
468 | { | ||
469 | char *tmp, *tok, *str = strdup(sort_order); | ||
470 | |||
471 | for (tok = strtok_r(str, ", ", &tmp); | ||
472 | tok; tok = strtok_r(NULL, ", ", &tmp)) | ||
473 | sort_dimension__add(tok); | ||
474 | |||
475 | free(str); | ||
476 | } | ||
477 | |||
478 | static int64_t | 468 | static int64_t |
479 | hist_entry__cmp(struct hist_entry *left, struct hist_entry *right) | 469 | hist_entry__cmp(struct hist_entry *left, struct hist_entry *right) |
480 | { | 470 | { |
@@ -880,6 +870,21 @@ static const struct option options[] = { | |||
880 | OPT_END() | 870 | OPT_END() |
881 | }; | 871 | }; |
882 | 872 | ||
873 | static void setup_sorting(void) | ||
874 | { | ||
875 | char *tmp, *tok, *str = strdup(sort_order); | ||
876 | |||
877 | for (tok = strtok_r(str, ", ", &tmp); | ||
878 | tok; tok = strtok_r(NULL, ", ", &tmp)) { | ||
879 | if (sort_dimension__add(tok) < 0) { | ||
880 | error("Unknown --sort key: `%s'", tok); | ||
881 | usage_with_options(report_usage, options); | ||
882 | } | ||
883 | } | ||
884 | |||
885 | free(str); | ||
886 | } | ||
887 | |||
883 | int cmd_report(int argc, const char **argv, const char *prefix) | 888 | int cmd_report(int argc, const char **argv, const char *prefix) |
884 | { | 889 | { |
885 | symbol__init(); | 890 | symbol__init(); |