Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752633AbbHSWUs (ORCPT ); Wed, 19 Aug 2015 18:20:48 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:34075 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752392AbbHSWUp (ORCPT ); Wed, 19 Aug 2015 18:20:45 -0400 MIME-Version: 1.0 In-Reply-To: <20150819221147.GK4524@tassilo.jf.intel.com> References: <1439973506-2166-1-git-send-email-eranian@google.com> <1439973506-2166-5-git-send-email-eranian@google.com> <20150819221147.GK4524@tassilo.jf.intel.com> Date: Wed, 19 Aug 2015 15:20:43 -0700 Message-ID: Subject: Re: [PATCH v1 4/4] perf script: enable printing of branch stack From: Stephane Eranian To: Andi Kleen Cc: LKML , Arnaldo Carvalho de Melo , Peter Zijlstra , "mingo@elte.hu" , Jiri Olsa , Namhyung Kim , "Liang, Kan" , David Ahern , Adrian Hunter Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1613 Lines: 43 On Wed, Aug 19, 2015 at 3:11 PM, Andi Kleen wrote: > On Wed, Aug 19, 2015 at 10:38:26AM +0200, Stephane Eranian wrote: >> This patch improves perf script by enabling printing of the >> branch stack via the 'brstack' argument to the field selection >> option -F. The option is off by default and operates only if the >> perf.data file has branch stack content. > > Thanks that's very useful. I wanted that several times. >> >> +static void print_sample_brstack(union perf_event *event __maybe_unused, >> + struct perf_sample *sample, >> + struct thread *thread __maybe_unused, >> + struct perf_event_attr *attr __maybe_unused) >> +{ >> + struct branch_stack *br = sample->branch_stack; >> + u64 i; >> + >> + if (!(br && br->nr)) >> + return; >> + >> + for (i = 0; i < br->nr; i++) { >> + printf(" 0x%"PRIx64"/0x%"PRIx64" ", br->entries[i].from, br->entries[i].to); > > Should print the various flags too. Also tip just added cycles information. > Ok, I will add that in v2. > Also it would be good to resolve the addresses to symbol + offset But then, that becomes harder to post-process or even read with long C++ signatures. > (and perhaps have support for srcline too). > > > -Andi > -- > ak@linux.intel.com -- Speaking for myself only -- 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/