lkml.org 
[lkml]   [2014]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] perf tools: Put callers above callee when callchain order is caller
Date
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


\
 
 \ /
  Last update: 2014-08-14 08:41    [W:0.121 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site