Messages in this thread Patch in this message | | | From | Namhyung Kim <> | Subject | [PATCH 2/3] perf tools: Put callers above callee when callchain order is caller | Date | Thu, 14 Aug 2014 15:01:39 +0900 |
| |
The perf report/top shows callers above their callees, but if user gives a callchain param to caller it's inverted. Fix it.
Cc: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> --- tools/perf/ui/hist.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index b5fa7019d2e2..eacbb561af78 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c @@ -197,14 +197,16 @@ static int __hpp__sort_acc(struct hist_entry *a, struct hist_entry *b, s64 ret = 0; if (symbol_conf.cumulate_callchain) { - /* - * Put caller above callee when they have equal period. - */ ret = field_cmp(get_field(a), get_field(b)); if (ret) return ret; + /* + * Put caller above callee when they have equal period. + */ ret = b->callchain->max_depth - a->callchain->max_depth; + if (callchain_param.order == ORDER_CALLER) + ret = -ret; } return ret; } -- 2.0.0
| |