diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2011-06-29 17:08:14 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2011-06-29 18:26:41 -0400 |
commit | fd8ea21276adefc7f0133bd42fcf3b2faf0b15f8 (patch) | |
tree | 7d4025ed1c68162f118bc29005ac76f0e9ea8dd8 /tools/perf | |
parent | e84d21227c6865fe1f3d0c79d1539b6877f54c84 (diff) |
perf tools: Allow sort dimensions to be registered more than once
So that the parent sort dimension can be registered twice: once
if we add it as an explicit sort dimension (-s parent) and twice
if we request a parent filter (-p foo).
We'll have only one parent sort dimension in the end but this
allows to override the default parent filter with we gave in "-p"
option. The goal of this is to prepare to allow the use of
"-s parent" and "-p foo" at the same time, ie: sort by filtered
parent.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Sam Liao <phyomh@gmail.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/sort.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index f5dba560d918..401e220566fd 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -260,15 +260,9 @@ int sort_dimension__add(const char *tok) | |||
260 | for (i = 0; i < ARRAY_SIZE(sort_dimensions); i++) { | 260 | for (i = 0; i < ARRAY_SIZE(sort_dimensions); i++) { |
261 | struct sort_dimension *sd = &sort_dimensions[i]; | 261 | struct sort_dimension *sd = &sort_dimensions[i]; |
262 | 262 | ||
263 | if (sd->taken) | ||
264 | continue; | ||
265 | |||
266 | if (strncasecmp(tok, sd->name, strlen(tok))) | 263 | if (strncasecmp(tok, sd->name, strlen(tok))) |
267 | continue; | 264 | continue; |
268 | 265 | ||
269 | if (sd->entry->se_collapse) | ||
270 | sort__need_collapse = 1; | ||
271 | |||
272 | if (sd->entry == &sort_parent) { | 266 | if (sd->entry == &sort_parent) { |
273 | int ret = regcomp(&parent_regex, parent_pattern, REG_EXTENDED); | 267 | int ret = regcomp(&parent_regex, parent_pattern, REG_EXTENDED); |
274 | if (ret) { | 268 | if (ret) { |
@@ -281,6 +275,12 @@ int sort_dimension__add(const char *tok) | |||
281 | sort__has_parent = 1; | 275 | sort__has_parent = 1; |
282 | } | 276 | } |
283 | 277 | ||
278 | if (sd->taken) | ||
279 | return 0; | ||
280 | |||
281 | if (sd->entry->se_collapse) | ||
282 | sort__need_collapse = 1; | ||
283 | |||
284 | if (list_empty(&hist_entry__sort_list)) { | 284 | if (list_empty(&hist_entry__sort_list)) { |
285 | if (!strcmp(sd->name, "pid")) | 285 | if (!strcmp(sd->name, "pid")) |
286 | sort__first_dimension = SORT_PID; | 286 | sort__first_dimension = SORT_PID; |