aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/callchain.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2013-07-18 18:33:57 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-07-22 11:42:18 -0400
commit99571ab3d9b342a717295a9c7e2b4495ee19e32a (patch)
tree57ed4dcf8286243b1451e0c1c4b472e70b7bf2f7 /tools/perf/util/callchain.c
parenta198996c7afae0097c67a61851f19863e59697b2 (diff)
perf tools: Support callchain sorting based on addresses
With programs with very large functions it can be useful to distinguish the callgraph nodes on more than just function names. So for example if you have multiple calls to the same function, it ends up being separate nodes in the chain. This patch adds a new key field to the callgraph options, that allows comparing nodes on functions (as today, default) and addresses. Longer term it would be nice to also handle src lines, but that would need more changes and address is a reasonable proxy for it today. I right now reference the global params, as there was no simple way to register a params pointer. Signed-off-by: Andi Kleen <ak@linux.intel.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Link: http://lkml.kernel.org/n/tip-0uskktybf0e7wrnoi5e9b9it@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/callchain.c')
-rw-r--r--tools/perf/util/callchain.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 42b6a632fe7b..4fee33b229b0 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -15,6 +15,7 @@
15#include <errno.h> 15#include <errno.h>
16#include <math.h> 16#include <math.h>
17 17
18#include "hist.h"
18#include "util.h" 19#include "util.h"
19#include "callchain.h" 20#include "callchain.h"
20 21
@@ -327,7 +328,8 @@ append_chain(struct callchain_node *root,
327 /* 328 /*
328 * Lookup in the current node 329 * Lookup in the current node
329 * If we have a symbol, then compare the start to match 330 * If we have a symbol, then compare the start to match
330 * anywhere inside a function. 331 * anywhere inside a function, unless function
332 * mode is disabled.
331 */ 333 */
332 list_for_each_entry(cnode, &root->val, list) { 334 list_for_each_entry(cnode, &root->val, list) {
333 struct callchain_cursor_node *node; 335 struct callchain_cursor_node *node;
@@ -339,7 +341,8 @@ append_chain(struct callchain_node *root,
339 341
340 sym = node->sym; 342 sym = node->sym;
341 343
342 if (cnode->ms.sym && sym) { 344 if (cnode->ms.sym && sym &&
345 callchain_param.key == CCKEY_FUNCTION) {
343 if (cnode->ms.sym->start != sym->start) 346 if (cnode->ms.sym->start != sym->start)
344 break; 347 break;
345 } else if (cnode->ip != node->ip) 348 } else if (cnode->ip != node->ip)