From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933549AbeAXLv4 (ORCPT ); Wed, 24 Jan 2018 06:51:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35396 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933257AbeAXLvy (ORCPT ); Wed, 24 Jan 2018 06:51:54 -0500 From: Jiri Olsa To: Peter Zijlstra , Ingo Molnar Cc: lkml , Namhyung Kim , David Ahern , Andi Kleen , Alexander Shishkin , Andy Lutomirski , Arnaldo Carvalho de Melo Subject: [PATCH 03/21] perf tools: Add callchain__printf for pure callchain dump Date: Wed, 24 Jan 2018 12:51:25 +0100 Message-Id: <20180124115143.14322-4-jolsa@kernel.org> In-Reply-To: <20180124115143.14322-1-jolsa@kernel.org> References: <20180124115143.14322-1-jolsa@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding callchain__printf for the pure callchain dump without the lbr portion, it will be used later in this patchset. The lbr dump is now included in the new perf_evsel__callchain__printf function. Link: http://lkml.kernel.org/n/tip-xg1o9sr5p4yfxe61lu13m802@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/util/session.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index c71ced7db152..da0635e2f100 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -917,15 +917,11 @@ static void callchain__lbr_callstack_printf(struct perf_sample *sample) } } -static void callchain__printf(struct perf_evsel *evsel, - struct perf_sample *sample) +static void callchain__printf(struct perf_sample *sample) { unsigned int i; struct ip_callchain *callchain = sample->callchain; - if (perf_evsel__has_branch_callstack(evsel)) - callchain__lbr_callstack_printf(sample); - printf("... FP chain: nr:%" PRIu64 "\n", callchain->nr); for (i = 0; i < callchain->nr; i++) @@ -933,6 +929,16 @@ static void callchain__printf(struct perf_evsel *evsel, i, callchain->ips[i]); } +static void +perf_evsel__callchain__printf(struct perf_evsel *evsel, + struct perf_sample *sample) +{ + if (perf_evsel__has_branch_callstack(evsel)) + callchain__lbr_callstack_printf(sample); + + callchain__printf(sample); +} + static void branch_stack__printf(struct perf_sample *sample) { uint64_t i; @@ -1095,7 +1101,7 @@ static void dump_sample(struct perf_evsel *evsel, union perf_event *event, sample_type = evsel->attr.sample_type; if (sample_type & PERF_SAMPLE_CALLCHAIN) - callchain__printf(evsel, sample); + perf_evsel__callchain__printf(evsel, sample); if ((sample_type & PERF_SAMPLE_BRANCH_STACK) && !perf_evsel__has_branch_callstack(evsel)) branch_stack__printf(sample); -- 2.13.6