[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-5352f35d6ae7b8b981d77137fb268bc54d10624f@git.kernel.org>
Date: Wed, 3 Jun 2009 09:48:48 GMT
From: tip-bot for Ingo Molnar <mingo@...e.hu>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, acme@...hat.com, paulus@...ba.org,
hpa@...or.com, mingo@...hat.com, jkacur@...hat.com,
a.p.zijlstra@...llo.nl, efault@....de, mtosatti@...hat.com,
tglx@...utronix.de, cjashfor@...ux.vnet.ibm.com, mingo@...e.hu
Subject: [tip:perfcounters/core] perf report: Improve sort key recognition
Commit-ID: 5352f35d6ae7b8b981d77137fb268bc54d10624f
Gitweb: http://git.kernel.org/tip/5352f35d6ae7b8b981d77137fb268bc54d10624f
Author: Ingo Molnar <mingo@...e.hu>
AuthorDate: Wed, 3 Jun 2009 10:07:39 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Wed, 3 Jun 2009 10:07:39 +0200
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@...llo.nl>
Cc: Mike Galbraith <efault@....de>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: John Kacur <jkacur@...hat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
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 6207a31..a8d3905 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)
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();
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists