mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 15:11:31 +00:00
perf report: Improve sort key recognition
- allow case-insensitive tokens - such as --sort Comm,Symbol - allow substring shortcuts: --sort sym - detect invalid tokens and bail out Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: John Kacur <jkacur@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
3502973d00
commit
5352f35d6a
@ -453,28 +453,18 @@ static int sort_dimension__add(char *tok)
|
||||
if (sd->taken)
|
||||
continue;
|
||||
|
||||
if (strcmp(tok, sd->name))
|
||||
if (strncasecmp(tok, sd->name, strlen(tok)))
|
||||
continue;
|
||||
|
||||
list_add_tail(&sd->entry->list, &hist_entry__sort_list);
|
||||
sd->taken = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -ESRCH;
|
||||
}
|
||||
|
||||
static void setup_sorting(void)
|
||||
{
|
||||
char *tmp, *tok, *str = strdup(sort_order);
|
||||
|
||||
for (tok = strtok_r(str, ", ", &tmp);
|
||||
tok; tok = strtok_r(NULL, ", ", &tmp))
|
||||
sort_dimension__add(tok);
|
||||
|
||||
free(str);
|
||||
}
|
||||
|
||||
static int64_t
|
||||
hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
|
||||
{
|
||||
@ -880,6 +870,21 @@ static const struct option options[] = {
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
static void setup_sorting(void)
|
||||
{
|
||||
char *tmp, *tok, *str = strdup(sort_order);
|
||||
|
||||
for (tok = strtok_r(str, ", ", &tmp);
|
||||
tok; tok = strtok_r(NULL, ", ", &tmp)) {
|
||||
if (sort_dimension__add(tok) < 0) {
|
||||
error("Unknown --sort key: `%s'", tok);
|
||||
usage_with_options(report_usage, options);
|
||||
}
|
||||
}
|
||||
|
||||
free(str);
|
||||
}
|
||||
|
||||
int cmd_report(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
symbol__init();
|
||||
|
Loading…
Reference in New Issue
Block a user