aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2015-11-17 10:05:39 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-11-23 16:31:01 -0500
commit8dc0564d809e3903834950e2d12f6d1d2fcff708 (patch)
tree621bafd4dd7629d081f1a5d73758e9429fa9d99f /tools/perf
parentcb1dc22dce6e54dbd1eac213c9216e1aa57084da (diff)
perf test: Add callchain order setup for DWARF unwinder test
Adding callchain order setup for DWARF unwinder test. The test now runs unwinder for both callee and caller orders. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Milian Wolff <milian.wolff@kdab.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1447772739-18471-4-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/tests/dwarf-unwind.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
index 01f0b61de53d..b2357e8115a2 100644
--- a/tools/perf/tests/dwarf-unwind.c
+++ b/tools/perf/tests/dwarf-unwind.c
@@ -51,6 +51,12 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
51 "krava_1", 51 "krava_1",
52 "test__dwarf_unwind" 52 "test__dwarf_unwind"
53 }; 53 };
54 /*
55 * The funcs[MAX_STACK] array index, based on the
56 * callchain order setup.
57 */
58 int idx = callchain_param.order == ORDER_CALLER ?
59 MAX_STACK - *cnt - 1 : *cnt;
54 60
55 if (*cnt >= MAX_STACK) { 61 if (*cnt >= MAX_STACK) {
56 pr_debug("failed: crossed the max stack value %d\n", MAX_STACK); 62 pr_debug("failed: crossed the max stack value %d\n", MAX_STACK);
@@ -63,8 +69,10 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
63 return -1; 69 return -1;
64 } 70 }
65 71
66 pr_debug("got: %s 0x%" PRIx64 "\n", symbol, entry->ip); 72 (*cnt)++;
67 return strcmp((const char *) symbol, funcs[(*cnt)++]); 73 pr_debug("got: %s 0x%" PRIx64 ", expecting %s\n",
74 symbol, entry->ip, funcs[idx]);
75 return strcmp((const char *) symbol, funcs[idx]);
68} 76}
69 77
70__attribute__ ((noinline)) 78__attribute__ ((noinline))
@@ -105,8 +113,16 @@ static int compare(void *p1, void *p2)
105 /* Any possible value should be 'thread' */ 113 /* Any possible value should be 'thread' */
106 struct thread *thread = *(struct thread **)p1; 114 struct thread *thread = *(struct thread **)p1;
107 115
108 if (global_unwind_retval == -INT_MAX) 116 if (global_unwind_retval == -INT_MAX) {
117 /* Call unwinder twice for both callchain orders. */
118 callchain_param.order = ORDER_CALLER;
119
109 global_unwind_retval = unwind_thread(thread); 120 global_unwind_retval = unwind_thread(thread);
121 if (!global_unwind_retval) {
122 callchain_param.order = ORDER_CALLEE;
123 global_unwind_retval = unwind_thread(thread);
124 }
125 }
110 126
111 return p1 - p2; 127 return p1 - p2;
112} 128}