1. 09 Mar, 2012 5 commits
    • Stephane Eranian's avatar
      perf tools: Enable reading of perf.data files from different ABI rev · 69996df4
      Stephane Eranian authored
      This patch allows perf to process perf.data files generated
      using an ABI that has a different perf_event_attr struct size,
      i.e., a different ABI version.
      
      The perf_event_attr can be extended, yet perf needs to cope with
      older perf.data files. Similarly, perf must be able to cope with
      a perf.data file which is using a newer version of the ABI than
      what it knows about.
      
      This patch adds read_attr(), a routine that reads a
      perf_event_attr struct from a file incrementally based on its
      advertised size. If the on-file struct is smaller than what perf
      knows, then the extra fields are zeroed. If the on-file struct
      is bigger, then perf only uses what it knows about, the rest is
      skipped.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: peterz@infradead.org
      Cc: acme@redhat.com
      Cc: robert.richter@amd.com
      Cc: ming.m.lin@intel.com
      Cc: andi@firstfloor.org
      Cc: asharma@fb.com
      Cc: ravitillo@lbl.gov
      Cc: vweaver1@eecs.utk.edu
      Cc: khandual@linux.vnet.ibm.com
      Cc: dsahern@gmail.com
      Link: http://lkml.kernel.org/r/1328826068-11713-17-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      69996df4
    • Stephane Eranian's avatar
      perf: Add ABI reference sizes · cb5d7699
      Stephane Eranian authored
      This patch adds reference sizes for revision 1
      and 2 of the perf_event ABI, i.e., the size of
      the perf_event_attr struct.
      
      With Rev1: config2 was added = +8 bytes
      With Rev2: branch_sample_type was added = +8 bytes
      
      Adds the definition for Rev1, Rev2.
      
      This is useful for tools trying to decode the revision
      numbers based on the size of the struct.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: peterz@infradead.org
      Cc: acme@redhat.com
      Cc: robert.richter@amd.com
      Cc: ming.m.lin@intel.com
      Cc: andi@firstfloor.org
      Cc: asharma@fb.com
      Cc: ravitillo@lbl.gov
      Cc: vweaver1@eecs.utk.edu
      Cc: khandual@linux.vnet.ibm.com
      Cc: dsahern@gmail.com
      Link: http://lkml.kernel.org/r/1328826068-11713-16-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      cb5d7699
    • Roberto Agostino Vitillo's avatar
      perf report: Add support for taken branch sampling · b50311dc
      Roberto Agostino Vitillo authored
      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
      
      About half (52%) of the call branches captured are from main()
      -> f1(). The second half (24%+23%) is split in two equal shares
      between f1() -> f2(), f1() ->f3(). The output is as expected
      given the code.
      
      It should be noted, that using -b in perf record does not
      eliminate information in the perf.data file. Consequently, a
      typical profile can also be obtained by perf report by simply
      not using its -b option.
      
      It is possible to sort on branch related columns:
      
         - dso_from, symbol_from
         - dso_to, symbol_to
         - mispredict
      Signed-off-by: default avatarRoberto Agostino Vitillo <ravitillo@lbl.gov>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: peterz@infradead.org
      Cc: acme@redhat.com
      Cc: robert.richter@amd.com
      Cc: ming.m.lin@intel.com
      Cc: andi@firstfloor.org
      Cc: asharma@fb.com
      Cc: vweaver1@eecs.utk.edu
      Cc: khandual@linux.vnet.ibm.com
      Cc: dsahern@gmail.com
      Link: http://lkml.kernel.org/r/1328826068-11713-14-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b50311dc
    • Roberto Agostino Vitillo's avatar
      perf record: Add support for sampling taken branch · bdfebd84
      Roberto Agostino Vitillo authored
      This patch adds a new option to enable taken branch stack
      sampling, i.e., leverage the PERF_SAMPLE_BRANCH_STACK feature
      of perf_events.
      
      There is a new option to active this mode: -b.
      It is possible to pass a set of filters to select the type of
      branches to sample.
      
      The following filters are available:
      
       - any : any type of branches
       - any_call : any function call or system call
       - any_ret : any function return or system call return
       - any_ind : any indirect branch
       - u:  only when the branch target is at the user level
       - k: only when the branch target is in the kernel
       - hv: only when the branch target is in the hypervisor
      
      Filters can be combined by passing a comma separated list
      to the option:
      
      $ perf record -b any_call,u -e cycles:u branchy
      Signed-off-by: default avatarRoberto Agostino Vitillo <ravitillo@lbl.gov>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: peterz@infradead.org
      Cc: acme@redhat.com
      Cc: robert.richter@amd.com
      Cc: ming.m.lin@intel.com
      Cc: andi@firstfloor.org
      Cc: asharma@fb.com
      Cc: vweaver1@eecs.utk.edu
      Cc: khandual@linux.vnet.ibm.com
      Cc: dsahern@gmail.com
      Link: http://lkml.kernel.org/r/1328826068-11713-13-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      bdfebd84
    • Roberto Agostino Vitillo's avatar
      perf tools: Add code to support PERF_SAMPLE_BRANCH_STACK · b5387528
      Roberto Agostino Vitillo authored
      This patch adds:
      
       - ability to parse samples with PERF_SAMPLE_BRANCH_STACK
       - sort on branches (dso_from, symbol_from, dso_to, symbol_to, mispredict)
       - build histograms on branches
      Signed-off-by: default avatarRoberto Agostino Vitillo <ravitillo@lbl.gov>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: peterz@infradead.org
      Cc: acme@redhat.com
      Cc: robert.richter@amd.com
      Cc: ming.m.lin@intel.com
      Cc: andi@firstfloor.org
      Cc: asharma@fb.com
      Cc: vweaver1@eecs.utk.edu
      Cc: khandual@linux.vnet.ibm.com
      Cc: dsahern@gmail.com
      Link: http://lkml.kernel.org/r/1328826068-11713-12-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b5387528
  2. 05 Mar, 2012 12 commits
  3. 03 Mar, 2012 3 commits
  4. 02 Mar, 2012 2 commits
  5. 29 Feb, 2012 4 commits
  6. 28 Feb, 2012 3 commits
  7. 27 Feb, 2012 11 commits