diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-10-22 17:23:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-23 01:55:16 -0400 |
commit | af0a6fa46388e1e0c2d1a672aad84f8f6ef0b20b (patch) | |
tree | 961592b767ecda1e2ac85b997f64bc1665f0b249 /tools/perf/util/sort.c | |
parent | 4e3b799d7dbb2a12ca8dca8d3594d32095772973 (diff) |
perf tools: Fix missing top level callchain
While recursively printing the branches of each callchains, we
forget to display the root. It is never printed.
Say we have:
symbol
f1
f2
|
-------- f3
| f4
|
---------f5
f6
Actually we never see that, instead it displays:
symbol
|
--------- f3
| f4
|
--------- f5
f6
However f1 is always the same than "symbol" and if we are
sorting by symbols first then "symbol", f1 and f2 will be well
aligned like in the above example, so displaying f1 looks
redundant here.
But if we are sorting by something else first (dso, comm,
etc...), displaying f1 doesn't look redundant but rather
necessary because the symbol is not well aligned anymore with
its callchain:
comm dso symbol
f1
f2
|
--------- [...]
And we want the callchain to be obvious.
So we fix the bug by printing the root branch, but we also
filter its first entry if we are sorting by symbols first.
Reported-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1256246604-17156-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/sort.c')
-rw-r--r-- | tools/perf/util/sort.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 40c9acd41cad..60ced707bd6b 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -5,8 +5,9 @@ char default_parent_pattern[] = "^sys_|^do_page_fault"; | |||
5 | char *parent_pattern = default_parent_pattern; | 5 | char *parent_pattern = default_parent_pattern; |
6 | char default_sort_order[] = "comm,dso,symbol"; | 6 | char default_sort_order[] = "comm,dso,symbol"; |
7 | char *sort_order = default_sort_order; | 7 | char *sort_order = default_sort_order; |
8 | int sort__need_collapse = 0; | 8 | int sort__need_collapse = 0; |
9 | int sort__has_parent = 0; | 9 | int sort__has_parent = 0; |
10 | int sort_by_sym_first; | ||
10 | 11 | ||
11 | unsigned int dsos__col_width; | 12 | unsigned int dsos__col_width; |
12 | unsigned int comms__col_width; | 13 | unsigned int comms__col_width; |
@@ -265,6 +266,10 @@ int sort_dimension__add(const char *tok) | |||
265 | sort__has_parent = 1; | 266 | sort__has_parent = 1; |
266 | } | 267 | } |
267 | 268 | ||
269 | if (list_empty(&hist_entry__sort_list) && | ||
270 | !strcmp(sd->name, "symbol")) | ||
271 | sort_by_sym_first = true; | ||
272 | |||
268 | list_add_tail(&sd->entry->list, &hist_entry__sort_list); | 273 | list_add_tail(&sd->entry->list, &hist_entry__sort_list); |
269 | sd->taken = 1; | 274 | sd->taken = 1; |
270 | 275 | ||
@@ -273,4 +278,3 @@ int sort_dimension__add(const char *tok) | |||
273 | 278 | ||
274 | return -ESRCH; | 279 | return -ESRCH; |
275 | } | 280 | } |
276 | |||