linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Stephane Eranian <eranian@google.com>
Cc: Roberto Agostino Vitillo <ravitillo@lbl.gov>,
	linux-kernel@vger.kernel.org, peterz@infradead.org,
	acme@redhat.com, robert.richter@amd.com, ming.m.lin@intel.com,
	andi@firstfloor.org, asharma@fb.com, vweaver1@eecs.utk.edu,
	khandual@linux.vnet.ibm.com, dsahern@gmail.com
Subject: Re: [PATCH v6 13/18] perf: add support for taken branch sampling to perf report
Date: Thu, 23 Feb 2012 10:59:22 +0100	[thread overview]
Message-ID: <20120223095922.GC24310@elte.hu> (raw)
In-Reply-To: <CABPqkBQz0G6DQfAfzD2=1mCDvmVsaZhFjW0qEh4y+rNxtbLC4Q@mail.gmail.com>


* Stephane Eranian <eranian@google.com> wrote:

> On Wed, Feb 22, 2012 at 12:15 PM, Ingo Molnar <mingo@elte.hu> wrote:
> >
> > * Stephane Eranian <eranian@google.com> wrote:
> >
> >> From: Roberto Agostino Vitillo <ravitillo@lbl.gov>
> >>
> >> This patch adds support for taken branch sampling, i.e, the
> >> PERF_SAMPLE_BRANCH_STACK feature to perf report. In other
> >> words, to display histograms based on taken branches rather
> >> than executed instructions addresses.
> >>
> >> The new option is called -b and it takes no argument. To
> >> generate meaningful output, the perf.data must have been
> >> obtained using perf record -b xxx ... where xxx is a branch
> >> filter option.
> >>
> >> The output shows symbols, modules, sorted by 'who branches
> >> where' the most often. The percentages reported in the first
> >> column refer to the total number of branches captured and
> >> not the usual number of samples.
> >>
> >> Here is a quick example.
> >> Here branchy is simple test program which looks as follows:
> >>
> >> void f2(void)
> >> {}
> >> void f3(void)
> >> {}
> >> void f1(unsigned long n)
> >> {
> >>   if (n & 1UL)
> >>     f2();
> >>   else
> >>     f3();
> >> }
> >> int main(void)
> >> {
> >>   unsigned long i;
> >>
> >>   for (i=0; i < N; i++)
> >>    f1(i);
> >>   return 0;
> >> }
> >>
> >> Here is the output captured on Nehalem, if we are
> >> only interested in user level function calls.
> >>
> >> $ perf record -b any_call,u -e cycles:u branchy
> >>
> >> $ perf report -b --sort=symbol
> >>     52.34%  [.] main                   [.] f1
> >>     24.04%  [.] f1                     [.] f3
> >>     23.60%  [.] f1                     [.] f2
> >>      0.01%  [k] _IO_new_file_xsputn    [k] _IO_file_overflow
> >>      0.01%  [k] _IO_vfprintf_internal  [k] _IO_new_file_xsputn
> >>      0.01%  [k] _IO_vfprintf_internal  [k] strchrnul
> >>      0.01%  [k] __printf               [k] _IO_vfprintf_internal
> >>      0.01%  [k] main                   [k] __printf
> >
> > Ok, nice feature.
> >
> > One detail needs to be fixed though, if someone does:
> >
> >  perf record -b ...
> >
> > then 'perf report' should *default* to the above branch stack
> > output style, without having to specify -b again.
> >
> Fair enough.
> 
> I'll check how we could do that. It's not so obvious as the code
> stands. I think we may need to add a new feature bit for that.
> It would avoid having to sniff either the cmdline, the event desc
> or worst the samples themselves.

Yeah, a feature bit for that looks like the ideal solution 
anyway.

Btw., the exact perf record command line ought to be 
reproducible from the metadata stored in the perf.data.

It should be possible to type:

   perf record --replay

or so, which takes a look at the perf.data and repeats that 
exact measurement. Something like this:

   perf record -R -F 10000

could be used to repeat the last measurement, with higher 
frequency sampling.

Thanks,

	Ingo

  reply	other threads:[~2012-02-23 10:00 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09 22:20 [PATCH v6 00/18] perf: add support for sampling taken branches Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 01/18] perf: add generic taken branch sampling support Stephane Eranian
2012-03-09 13:19   ` [tip:perf/hw-branch-sampling] perf: Add " tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 02/18] perf: add Intel LBR MSR definitions Stephane Eranian
2012-03-09 13:20   ` [tip:perf/hw-branch-sampling] perf/x86: Add " tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 03/18] perf: add Intel X86 LBR sharing logic Stephane Eranian
2012-03-09 13:21   ` [tip:perf/hw-branch-sampling] perf/x86: Add Intel " tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 04/18] perf: sync branch stack sampling with X86 precise_sampling Stephane Eranian
2012-03-09 13:21   ` [tip:perf/hw-branch-sampling] perf/x86: Sync branch stack sampling with precise_sampling tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 05/18] perf: add Intel X86 LBR mappings for PERF_SAMPLE_BRANCH filters Stephane Eranian
2012-03-09 13:22   ` [tip:perf/hw-branch-sampling] perf/x86: Add Intel " tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 06/18] perf: disable LBR support for older Intel Atom processors Stephane Eranian
2012-03-09 13:23   ` [tip:perf/hw-branch-sampling] perf/x86: Disable " tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 07/18] perf: implement PERF_SAMPLE_BRANCH for Intel X86 Stephane Eranian
2012-03-09 13:24   ` [tip:perf/hw-branch-sampling] perf/x86: Implement PERF_SAMPLE_BRANCH for Intel CPUs tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 08/18] perf: add LBR software filter support for Intel X86 Stephane Eranian
2012-03-09 13:25   ` [tip:perf/hw-branch-sampling] perf/x86: Add LBR software filter support for Intel CPUs tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 09/18] perf: disable PERF_SAMPLE_BRANCH_* when not supported Stephane Eranian
2012-03-09 13:26   ` [tip:perf/hw-branch-sampling] perf: Disable " tip-bot for Stephane Eranian
2012-02-09 22:21 ` [PATCH v6 10/18] perf: add hook to flush branch_stack on context switch Stephane Eranian
2012-03-09 13:26   ` [tip:perf/hw-branch-sampling] perf: Add callback " tip-bot for Stephane Eranian
2012-02-09 22:21 ` [PATCH v6 11/18] perf: add code to support PERF_SAMPLE_BRANCH_STACK Stephane Eranian
2012-03-09 13:27   ` [tip:perf/hw-branch-sampling] perf tools: Add " tip-bot for Roberto Agostino Vitillo
2012-02-09 22:21 ` [PATCH v6 12/18] perf: add support for sampling taken branch to perf record Stephane Eranian
2012-03-09 13:28   ` [tip:perf/hw-branch-sampling] perf record: Add support for sampling taken branch tip-bot for Roberto Agostino Vitillo
2012-02-09 22:21 ` [PATCH v6 13/18] perf: add support for taken branch sampling to perf report Stephane Eranian
2012-02-14 21:47   ` Arnaldo Carvalho de Melo
2012-02-22 11:15   ` Ingo Molnar
2012-02-22 16:18     ` Stephane Eranian
2012-02-23  9:59       ` Ingo Molnar [this message]
2012-02-23 16:53         ` Stephane Eranian
2012-02-23 18:11           ` Arnaldo Carvalho de Melo
2012-02-23 20:48             ` Stephane Eranian
2012-03-09 13:29   ` [tip:perf/hw-branch-sampling] perf report: Add support for taken branch sampling tip-bot for Roberto Agostino Vitillo
2012-02-09 22:21 ` [PATCH v6 14/18] perf: fix endianness detection in perf.data Stephane Eranian
2012-02-09 22:32   ` David Ahern
2012-02-09 22:21 ` [PATCH v6 15/18] perf: add ABI reference sizes Stephane Eranian
2012-03-09 13:30   ` [tip:perf/hw-branch-sampling] perf: Add " tip-bot for Stephane Eranian
2012-02-09 22:21 ` [PATCH v6 16/18] perf: enable reading of perf.data files from different ABI rev Stephane Eranian
2012-02-09 22:39   ` David Ahern
2012-02-09 22:41     ` Stephane Eranian
2012-02-09 22:46       ` David Ahern
2012-02-09 22:49         ` Stephane Eranian
2012-02-10  0:37   ` David Ahern
2012-03-09 13:30   ` [tip:perf/hw-branch-sampling] perf tools: Enable reading of perf. data " tip-bot for Stephane Eranian
2012-02-09 22:21 ` [PATCH v6 17/18] perf: fix bug print_event_desc() Stephane Eranian
2012-03-09 13:31   ` [tip:perf/hw-branch-sampling] perf tools: Fix ABI compatibility bug in print_event_desc() tip-bot for Stephane Eranian
2012-02-09 22:21 ` [PATCH v6 18/18] perf: make perf able to read file from older ABIs Stephane Eranian
2012-03-09 13:32   ` [tip:perf/hw-branch-sampling] perf tools: Make perf able to read files " tip-bot for Stephane Eranian
2012-02-27  7:50 ` [PATCH v6 00/18] perf: add support for sampling taken branches Anshuman Khandual
2012-02-27  8:45   ` Stephane Eranian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120223095922.GC24310@elte.hu \
    --to=mingo@elte.hu \
    --cc=acme@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=asharma@fb.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=peterz@infradead.org \
    --cc=ravitillo@lbl.gov \
    --cc=robert.richter@amd.com \
    --cc=vweaver1@eecs.utk.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).