diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/sort.c | 15 | ||||
-rw-r--r-- | tools/perf/util/sort.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index b490354d1b23..cff1c316fa91 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -288,3 +288,18 @@ int sort_dimension__add(const char *tok) | |||
288 | 288 | ||
289 | return -ESRCH; | 289 | return -ESRCH; |
290 | } | 290 | } |
291 | |||
292 | void setup_sorting(const char * const usagestr[], const struct option *opts) | ||
293 | { | ||
294 | char *tmp, *tok, *str = strdup(sort_order); | ||
295 | |||
296 | for (tok = strtok_r(str, ", ", &tmp); | ||
297 | tok; tok = strtok_r(NULL, ", ", &tmp)) { | ||
298 | if (sort_dimension__add(tok) < 0) { | ||
299 | error("Unknown --sort key: `%s'", tok); | ||
300 | usage_with_options(usagestr, opts); | ||
301 | } | ||
302 | } | ||
303 | |||
304 | free(str); | ||
305 | } | ||
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index 333e664ff45f..cb6151c026f2 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h | |||
@@ -81,6 +81,8 @@ struct sort_entry { | |||
81 | extern struct sort_entry sort_thread; | 81 | extern struct sort_entry sort_thread; |
82 | extern struct list_head hist_entry__sort_list; | 82 | extern struct list_head hist_entry__sort_list; |
83 | 83 | ||
84 | void setup_sorting(const char * const usagestr[], const struct option *opts); | ||
85 | |||
84 | extern int repsep_fprintf(FILE *fp, const char *fmt, ...); | 86 | extern int repsep_fprintf(FILE *fp, const char *fmt, ...); |
85 | extern size_t sort__thread_print(FILE *, struct hist_entry *, unsigned int); | 87 | extern size_t sort__thread_print(FILE *, struct hist_entry *, unsigned int); |
86 | extern size_t sort__comm_print(FILE *, struct hist_entry *, unsigned int); | 88 | extern size_t sort__comm_print(FILE *, struct hist_entry *, unsigned int); |