Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753923AbbKQPGB (ORCPT ); Tue, 17 Nov 2015 10:06:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55915 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753861AbbKQPFv (ORCPT ); Tue, 17 Nov 2015 10:05:51 -0500 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , David Ahern , Peter Zijlstra , Ingo Molnar , Namhyung Kim , Milian Wolff , Wang Nan Subject: [PATCH 3/3] perf test: Add callchain order setup for DWARF unwinder test Date: Tue, 17 Nov 2015 16:05:39 +0100 Message-Id: <1447772739-18471-4-git-send-email-jolsa@kernel.org> In-Reply-To: <1447772739-18471-1-git-send-email-jolsa@kernel.org> References: <1447772739-18471-1-git-send-email-jolsa@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2147 Lines: 65 Adding callchain order setup for DWARF unwinder test. The test now runs unwinder for both callee and caller orders. Link: http://lkml.kernel.org/n/tip-zz3q3vrre3re8efdw3c89aef@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/tests/dwarf-unwind.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c index 07221793a3ac..05d9ba387c43 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) "krava_1", "test__dwarf_unwind" }; + /* + * The funcs[MAX_STACK] array index, based on the + * callchain order setup. + */ + int idx = callchain_param.order == ORDER_CALLER ? + MAX_STACK - *cnt - 1 : *cnt; if (*cnt >= MAX_STACK) { 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) return -1; } - pr_debug("got: %s 0x%" PRIx64 "\n", symbol, entry->ip); - return strcmp((const char *) symbol, funcs[(*cnt)++]); + (*cnt)++; + pr_debug("got: %s 0x%" PRIx64 ", expecting %s\n", + symbol, entry->ip, funcs[idx]); + return strcmp((const char *) symbol, funcs[idx]); } __attribute__ ((noinline)) @@ -105,8 +113,16 @@ static int compare(void *p1, void *p2) /* Any possible value should be 'thread' */ struct thread *thread = *(struct thread **)p1; - if (global_unwind_retval == -INT_MAX) + if (global_unwind_retval == -INT_MAX) { + /* Call unwinder twice for both callchain orders. */ + callchain_param.order = ORDER_CALLER; + global_unwind_retval = unwind_thread(thread); + if (!global_unwind_retval) { + callchain_param.order = ORDER_CALLEE; + global_unwind_retval = unwind_thread(thread); + } + } return p1 - p2; } -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/