1. 04 Jul, 2016 4 commits
    • Masami Hiramatsu's avatar
      perf buildid-cache: Scan and import user SDT events to probe cache · 6430a94e
      Masami Hiramatsu authored
      perf buildid-cache --add <binary> scans given binary and add
      the SDT events to probe cache. "sdt_" prefix is appended for
      all SDT providers to avoid event-name clash with other pre-defined
      events. It is possible to use the cached SDT events as other cached
      events, via perf probe --add "sdt_<provider>:<event>=<event>".
      
      e.g.
        ----
        # perf buildid-cache --add /lib/libc-2.17.so
        # perf probe --cache --list | head -n 5
        /usr/lib/libc-2.17.so (a6fb821bdf53660eb2c29f778757aef294d3d392):
        sdt_libc:setjmp=setjmp
        sdt_libc:longjmp=longjmp
        sdt_libc:longjmp_target=longjmp_target
        sdt_libc:memory_heap_new=memory_heap_new
        # perf probe -x /usr/lib/libc-2.17.so \
          -a sdt_libc:memory_heap_new=memory_heap_new
        Added new event:
          sdt_libc:memory_heap_new (on memory_heap_new
         in /usr/lib/libc-2.17.so)
      
        You can now use it in all perf tools, such as:
      
                perf record -e sdt_libc:memory_heap_new -aR sleep 1
      
        # perf probe -l
          sdt_libc:memory_heap_new (on new_heap+183 in /usr/lib/libc-2.17.so)
        ----
      
      Note that SDT event entries in probe-cache file is somewhat different
      from normal cached events. Normal one starts with "#", but SDTs are
      starting with "%".
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/146736025058.27797.13043265488541434502.stgit@devboxSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6430a94e
    • Masami Hiramatsu's avatar
      perf probe: Add group name support · 8d993d96
      Masami Hiramatsu authored
      Allow user to set group name for adding new event.  Note that user must
      ensure that the group name doesn't conflict with existing group name
      carefully.
      
      E.g. Existing group name can conflict with other events.  Especially,
      using the group name reserved for kernel modules can hide kernel
      embedded events when loading modules.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/146736024091.27797.9471545190066268995.stgit@devboxSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8d993d96
    • Hemant Kumar's avatar
      perf sdt: ELF support for SDT · 060fa0c7
      Hemant Kumar authored
      This patch serves the initial support to identify and list SDT events in
      binaries.  When programs containing SDT markers are compiled, gcc with
      the help of assembler directives identifies them and places them in the
      section ".note.stapsdt".
      
      To find these markers from the binaries, one needs to traverse through
      this section and parse the relevant details like the name, type and
      location of the marker. Also, the original location could be skewed due
      to the effect of prelinking. If that is the case, the locations need to
      be adjusted.
      
      The functions in this patch open a given ELF, find out the SDT section,
      parse the relevant details, adjust the location (if necessary) and
      populate them in a list.
      
      A typical note entry in ".note.stapsdt" section is as follows :
      
                                       |--nhdr.n_namesz--|
                      ------------------------------------
                      |      nhdr      |     "stapsdt"   |
              -----   |----------------------------------|
               |      |  <location>       <base_address> |
               |      |  <semaphore>                     |
      nhdr.n_descsize |  "provider_name"   "note_name"   |
               |      |   <args>                         |
              -----   |----------------------------------|
                      |      nhdr      |     "stapsdt"   |
                      |...
      
      The above shows an excerpt from the section ".note.stapsdt".  'nhdr' is
      a structure which has the note name size (n_namesz), note description
      size (n_desc_sz) and note type (n_type).
      
      So, in order to parse the note note info, we need nhdr to tell us where
      to start from.  As can be seen from <sys/sdt.h>, the name of the SDT
      notes given is "stapsdt".  But this is not the identifier of the note.
      
      After that, we go to description of the note to find out its location, the
      address of the ".stapsdt.base" section and the semaphore address.
      Then, we find the provider name and the SDT marker name and then follow the
      arguments.
      Signed-off-by: default avatarHemant Kumar <hemant@linux.vnet.ibm.com>
      Reviewed-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/146736022628.27797.1201368329092908163.stgit@devboxSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      060fa0c7
    • Arnaldo Carvalho de Melo's avatar
      perf build: Add feature detection for libelf's elf_getshdrstrndx() · 2492c465
      Arnaldo Carvalho de Melo authored
      That appeared after 0.140, and will be used in the SDT code, so, to
      avoid bisection break on older systems, add a feature detection and
      provide a stub with a pr_debug() to keep it building.
      
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/n/tip-80y0eldgweorqnwha9rvfxjr@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2492c465
  2. 01 Jul, 2016 4 commits
  3. 30 Jun, 2016 9 commits
  4. 29 Jun, 2016 3 commits
  5. 28 Jun, 2016 13 commits
  6. 27 Jun, 2016 7 commits