Skip to content
  1. May 06, 2015
    • Adrian Hunter's avatar
      perf tools: Add AUX area tracing Snapshot Mode · d20031bb
      Adrian Hunter authored
      
      
      Add support for making snapshots of AUX area tracing data.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1430404667-10593-9-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d20031bb
    • Adrian Hunter's avatar
      perf tools: Add support for PERF_RECORD_ITRACE_START · 0ad21f68
      Adrian Hunter authored
      
      
      Add support for the PERF_RECORD_ITRACE_START event type.  This event can
      be used to determine the pid and tid that are running when Instruction
      Tracing starts.  Generally that information would come from a
      sched_switch event but, at the start, no sched_switch events may yet
      have been recorded.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1430404667-10593-8-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0ad21f68
    • Adrian Hunter's avatar
      perf tools: Add support for PERF_RECORD_AUX · 4a96f7a0
      Adrian Hunter authored
      
      
      Add support for the PERF_RECORD_AUX event type.
      
      PERF_RECORD_AUX is a new kernel event that records when new data lands
      in the AUX buffer. Currently it is assumed that AUX data follows the
      same ring buffer conventions used by the perf events buffer, and
      consequently the AUX event is not processed during recording.
      
      It is processed during session processing so that the information in the
      'flags' member is made available.
      
      The format of PERF_RECORD_AUX is outlined in the linux/perf_events.h
      header file. The 'flags' are also enumerated.
      
      Intel PT and Intel BTS use the flag named PERF_AUX_FLAG_TRUNCATED to
      determine if data has been lost because the buffer became full as perf
      was not able to empty it fast enough.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1430404667-10593-7-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4a96f7a0
    • Adrian Hunter's avatar
      perf auxtrace: Add option to synthesize events for transactions · 53c76b0e
      Adrian Hunter authored
      
      
      Add AUX area tracing option 'x' to synthesize events for transactions.
      This will be used by Intel PT to synthesize an event record for each TSX
      start, commit or abort.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1430404667-10593-6-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      53c76b0e
    • Adrian Hunter's avatar
      perf tools: Add build option NO_AUXTRACE to exclude AUX area tracing · e31f0d01
      Adrian Hunter authored
      
      
      Add build option NO_AUXTRACE to exclude compiling support for AUX area
      tracing. Support for both recording and processing is excluded and by
      implication any future additions such as Intel PT and Intel BTS will
      also not be compiled in with this option.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1430404667-10593-5-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e31f0d01
  2. May 05, 2015
    • Adrian Hunter's avatar
      perf tools: Hit all build ids when AUX area tracing · cd10b289
      Adrian Hunter authored
      
      
      We need to include all buildids when a perf.data file contains AUX area
      tracing data because we do not decode the trace for that purpose because
      it would take too long.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1430404667-10593-4-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cd10b289
    • Adrian Hunter's avatar
      perf tools: Add AUX area tracing index · 99fa2984
      Adrian Hunter authored
      
      
      Add an index of AUX area tracing events within a perf.data file.
      
      perf record uses a special user event PERF_RECORD_FINISHED_ROUND to
      enable sorting of events in chunks instead of having to sort all events
      altogether.
      
      AUX area tracing events contain data that can span back to the very
      beginning of the recording period. i.e. they do not obey the rules of
      PERF_RECORD_FINISHED_ROUND.
      
      By adding an index, AUX area tracing events can be found in advance and
      the PERF_RECORD_FINISHED_ROUND approach works as usual.
      
      The index is recorded with the auxtrace feature in the perf.data file.
      A session reads the index but does not process it.  An AUX area decoder
      can queue all the AUX area data in advance using
      auxtrace_queues__process_index() or otherwise process the index in some
      custom manner.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1430404667-10593-3-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      99fa2984
    • Adrian Hunter's avatar
      perf report: Fix placement of itrace option in documentation · 64a7e61f
      Adrian Hunter authored
      
      
      Unwittingly the itrace options for perf report ended up below the
      Overhead Calculation section. Move it back with the other options.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1430404667-10593-2-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      64a7e61f
    • Namhyung Kim's avatar
      perf kmem: Add kmem.default config option · 0c160d49
      Namhyung Kim authored
      
      
      Currently perf kmem command will select --slab if neither --slab nor
      --page is given for backward compatibility.  Add kmem.default config
      option to select the default value ('page' or 'slab').
      
        # cat ~/.perfconfig
        [kmem]
        	default = page
      
        # perf kmem stat
      
        SUMMARY (page allocator)
        ========================
        Total allocation requests     :            1,518   [            6,096 KB ]
        Total free requests           :            1,431   [            5,748 KB ]
      
        Total alloc+freed requests    :            1,330   [            5,344 KB ]
        Total alloc-only requests     :              188   [              752 KB ]
        Total free-only requests      :              101   [              404 KB ]
      
        Total allocation failures     :                0   [                0 KB ]
        ...
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarPekka Enberg <penberg@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/1429592107-1807-6-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0c160d49
    • Namhyung Kim's avatar
      perf kmem: Print gfp flags in human readable string · 0e111156
      Namhyung Kim authored
      
      
      Save libtraceevent output and print it in the header.
      
        # perf kmem stat --page --caller
        #
        # GFP flags
        # ---------
        # 00000010:       NI: GFP_NOIO
        # 000000d0:        K: GFP_KERNEL
        # 00000200:      NWR: GFP_NOWARN
        # 000084d0:    K|R|Z: GFP_KERNEL|GFP_REPEAT|GFP_ZERO
        # 000200d2:       HU: GFP_HIGHUSER
        # 000200da:      HUM: GFP_HIGHUSER_MOVABLE
        # 000280da:    HUM|Z: GFP_HIGHUSER_MOVABLE|GFP_ZERO
        # 002084d0: K|R|Z|NT: GFP_KERNEL|GFP_REPEAT|GFP_ZERO|GFP_NOTRACK
        # 0102005a:  NF|HW|M: GFP_NOFS|GFP_HARDWALL|GFP_MOVABLE
      
        ---------------------------------------------------------------------------------------------------------
         Total alloc (KB) | Hits      | Order | Mig.type | GFP flags | Callsite
        ---------------------------------------------------------------------------------------------------------
                       60 |        15 |     0 | UNMOVABL | K|R|Z|NT  | pte_alloc_one
                       40 |        10 |     0 |  MOVABLE | HUM|Z     | handle_mm_fault
                       24 |         6 |     0 |  MOVABLE | HUM       | do_wp_page
                       24 |         6 |     0 | UNMOVABL | K         | __pollwait
         ...
      
      Requested-by: default avatarJoonsoo Kim <js1304@gmail.com>
      Suggested-by: default avatarMinchan Kim <minchan@kernel.org>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarPekka Enberg <penberg@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/1429592107-1807-5-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0e111156
    • Namhyung Kim's avatar
      perf kmem: Add --live option for current allocation stat · 2a7ef02c
      Namhyung Kim authored
      
      
      Currently 'perf kmem stat --page' shows total (page) allocation stat by
      default, but sometimes one might want to see live (total alloc-only)
      requests/pages only.  The new --live option does this by subtracting freed
      allocation from the stat.
      
      E.g.:
      
       # perf kmem stat --page
      
       SUMMARY (page allocator)
       ========================
       Total allocation requests     :          988,858   [        4,045,368 KB ]
       Total free requests           :          886,484   [        3,624,996 KB ]
      
       Total alloc+freed requests    :          885,969   [        3,622,628 KB ]
       Total alloc-only requests     :          102,889   [          422,740 KB ]
       Total free-only requests      :              515   [            2,368 KB ]
      
       Total allocation failures     :                0   [                0 KB ]
      
       Order     Unmovable   Reclaimable       Movable      Reserved  CMA/Isolated
       -----  ------------  ------------  ------------  ------------  ------------
           0       172,173         3,083       806,686             .             .
           1           284             .             .             .             .
           2         6,124            58             .             .             .
           3           114           335             .             .             .
           4             .             .             .             .             .
           5             .             .             .             .             .
           6             .             .             .             .             .
           7             .             .             .             .             .
           8             .             .             .             .             .
           9             .             .             1             .             .
          10             .             .             .             .             .
       # perf kmem stat --page --live
      
       SUMMARY (page allocator)
       ========================
       Total allocation requests     :          988,858   [        4,045,368 KB ]
       Total free requests           :          886,484   [        3,624,996 KB ]
      
       Total alloc+freed requests    :          885,969   [        3,622,628 KB ]
       Total alloc-only requests     :          102,889   [          422,740 KB ]
       Total free-only requests      :              515   [            2,368 KB ]
      
       Total allocation failures     :                0   [                0 KB ]
      
       Order     Unmovable   Reclaimable       Movable      Reserved  CMA/Isolated
       -----  ------------  ------------  ------------  ------------  ------------
           0         2,214         3,025        97,156             .             .
           1            59             .             .             .             .
           2            19            58             .             .             .
           3            23           335             .             .             .
           4             .             .             .             .             .
           5             .             .             .             .             .
           6             .             .             .             .             .
           7             .             .             .             .             .
           8             .             .             .             .             .
           9             .             .             .             .             .
          10             .             .             .             .             .
       #
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarPekka Enberg <penberg@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/1429592107-1807-4-git-send-email-namhyung@kernel.org
      [ Added examples to the changeset log ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2a7ef02c
    • Namhyung Kim's avatar
      perf kmem: Support sort keys on page analysis · fb4f313d
      Namhyung Kim authored
      
      
      Add new sort keys for page: page, order, migtype, gfp - existing
      'bytes', 'hit' and 'callsite' sort keys also work for page.  Note that
      -s/--sort option should be preceded by either of --slab or --page option
      to determine where the sort keys applies.
      
      Now it properly groups and sorts allocation stats - so same
      page/caller with different order/migtype/gfp will be printed on a
      different line.
      
       # perf kmem stat --page --caller -l 10 -s order,hit
      
       -----------------------------------------------------------------------------
       Total alloc (KB) | Hits   | Order | Mig.type | GFP flags | Callsite
       -----------------------------------------------------------------------------
                     64 |      4 |     2 |  RECLAIM |  00285250 | new_slab
                 50,144 | 12,536 |     0 |  MOVABLE |  0102005a | __page_cache_alloc
                     52 |     13 |     0 | UNMOVABL |  002084d0 | pte_alloc_one
                     40 |     10 |     0 |  MOVABLE |  000280da | handle_mm_fault
                     28 |      7 |     0 | UNMOVABL |  000000d0 | __pollwait
                     20 |      5 |     0 |  MOVABLE |  000200da | do_wp_page
                     20 |      5 |     0 |  MOVABLE |  000200da | do_cow_fault
                     16 |      4 |     0 | UNMOVABL |  00000200 | __tlb_remove_page
                     16 |      4 |     0 | UNMOVABL |  000084d0 | __pmd_alloc
                      8 |      2 |     0 | UNMOVABL |  000084d0 | __pud_alloc
       ...              | ...    | ...   | ...      | ...       | ...
       -----------------------------------------------------------------------------
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarPekka Enberg <penberg@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/1429592107-1807-3-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fb4f313d
  3. May 04, 2015
    • Namhyung Kim's avatar
      perf kmem: Implement stat --page --caller · c9758cc4
      Namhyung Kim authored
      
      
      It is 'perf kmem' support caller statistics for page.  Unlike slab case,
      the tracepoints in page allocator don't provide callsite info.  So it
      records with callchain and extracts callsite info.
      
      Note that the callchain contains several memory allocation functions
      which has no meaning for users.  So skip those functions to get proper
      callsites.  I used following regex pattern to skip the allocator
      functions:
      
        ^_?_?(alloc|get_free|get_zeroed)_pages?
      
      This gave me a following list of functions:
      
        # perf kmem record --page sleep 3
        # perf kmem stat --page -v
        ...
        alloc func: __get_free_pages
        alloc func: get_zeroed_page
        alloc func: alloc_pages_exact
        alloc func: __alloc_pages_direct_compact
        alloc func: __alloc_pages_nodemask
        alloc func: alloc_page_interleave
        alloc func: alloc_pages_current
        alloc func: alloc_pages_vma
        alloc func: alloc_page_buffers
        alloc func: alloc_pages_exact_nid
        ...
      
      The output looks mostly same as --alloc (I also added callsite column
      to that) but groups entries by callsite.  Currently, the order,
      migrate type and GFP flag info is for the last allocation and not
      guaranteed to be same for all allocations from the callsite.
      
        ---------------------------------------------------------------------------------------------
         Total_alloc (KB) | Hits      | Order | Mig.type | GFP flags | Callsite
        ---------------------------------------------------------------------------------------------
                    1,064 |       266 |     0 | UNMOVABL |  000000d0 | __pollwait
                       52 |        13 |     0 | UNMOVABL |  002084d0 | pte_alloc_one
                       44 |        11 |     0 |  MOVABLE |  000280da | handle_mm_fault
                       20 |         5 |     0 |  MOVABLE |  000200da | do_cow_fault
                       20 |         5 |     0 |  MOVABLE |  000200da | do_wp_page
                       16 |         4 |     0 | UNMOVABL |  000084d0 | __pmd_alloc
                       16 |         4 |     0 | UNMOVABL |  00000200 | __tlb_remove_page
                       12 |         3 |     0 | UNMOVABL |  000084d0 | __pud_alloc
                        8 |         2 |     0 | UNMOVABL |  00000010 | bio_copy_user_iov
                        4 |         1 |     0 | UNMOVABL |  000200d2 | pipe_write
                        4 |         1 |     0 |  MOVABLE |  000280da | do_wp_page
                        4 |         1 |     0 | UNMOVABL |  002084d0 | pgd_alloc
        ---------------------------------------------------------------------------------------------
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarPekka Enberg <penberg@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/1429592107-1807-2-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c9758cc4
    • Masami Hiramatsu's avatar
      perf probe: Accept filter argument for --list · b6a89643
      Masami Hiramatsu authored
      
      
      Currently, perf-probe --list option ignores given event filter.
        ----
        # ./perf probe -l vfs\*
          probe:vfs_read       (on vfs_read@ksrc/linux-3/fs/read_write.c)
          probe_libc:malloc    (on __libc_malloc@malloc/malloc.c in /usr/lib64/libc-2.17.so)
        ----
      
      This changes --list option to accept the event filter argument as below.
        ----
        # ./perf probe -l vfs\*
          probe:vfs_read       (on vfs_read@ksrc/linux-3/fs/read_write.c)
        # ./perf probe -l \*libc:\*
          probe_libc:malloc    (on __libc_malloc@malloc/malloc.c in /usr/lib64/libc-2.17.so)
        ----
      
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150424094750.23967.53868.stgit@localhost.localdomain
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b6a89643
    • Masami Hiramatsu's avatar
      perf probe: Accept multiple filter options · 96b55e39
      Masami Hiramatsu authored
      
      
      Accept multiple filter options. Each filters are combined by logical-or.
      E.g. --filter abc* --filter *def is same as --filter abc*|*def
      
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150424094748.23967.63355.stgit@localhost.localdomain
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      96b55e39
    • Masami Hiramatsu's avatar
      perf tools: Add strfilter__string to recover rules string · 3f51972c
      Masami Hiramatsu authored
      
      
      Add strfilter__string to recover rules string from strfilter.  This will
      be good for debugging.
      
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150424094746.23967.52434.stgit@localhost.localdomain
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3f51972c
    • Masami Hiramatsu's avatar
      perf tools: Improve strfilter to append additional rules · 4e60a2ca
      Masami Hiramatsu authored
      
      
      Add strfilter__or/and to append additional rules to existing strfilter.
      
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150424094744.23967.97614.stgit@localhost.localdomain
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4e60a2ca
    • Naveen N. Rao's avatar
      perf probe: Improve detection of file/function name in the probe pattern · 3099c026
      Naveen N. Rao authored
      
      
      Currently, perf probe considers patterns including a '.' to be a file.
      However, this causes problems on powerpc ABIv1 where all functions have
      a leading '.':
      
        $ perf probe -F | grep schedule_timeout_interruptible
        .schedule_timeout_interruptible
        $ perf probe .schedule_timeout_interruptible
        Semantic error :File always requires line number or lazy pattern.
          Error: Command Parse Error.
      
      Fix this:
      - by checking the probe pattern in more detail, and
      - skipping leading dot if one exists when creating/deleting events.
      
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Acked-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/db680f7cb11c4452b632f908e67151f3aa0f4602.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3099c026
    • Namhyung Kim's avatar
      perf tools: Fix bison-related build failure on CentOS 6 · 539f3aa2
      Namhyung Kim authored
      
      
      The YYLTYPE_IS_TRIVIAL is defined in the Build file, but unlike
      pmu-bison.c, gcc complained about it for parse-events-bison.c:
      
          CC       util/parse-events-bison.o
        In file included from util/parse-events.y:16:
        util/parse-events-bison.h:101:1: error: "YYLTYPE_IS_TRIVIAL" redefined
        <command-line>: error: this is the location of the previous definition
        make[3]: *** [util/parse-events-bison.o] Error 1
      
      Comments from Jiri Olsa:
      
      "Reason is the parse error handling that was added just recently: it
      adds YYLTYPE type (which is not present in pmu-bison.h), so
      YYLTYPE_IS_TRIVIAL gets redefined, which is ok in F20 that handle the
      error via '-w' option, but it's not ok for RHEL6 where the '-w' does not
      work for this kind of error."
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1430322871-18107-1-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      539f3aa2
    • Naveen N. Rao's avatar
      perf symbols: Warn on build id mismatch · 468f3d29
      Naveen N. Rao authored
      
      
      Add a debug message to indicate that the build id didn't match.
      
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1429904686-16516-1-git-send-email-naveen.n.rao@linux.vnet.ibm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      468f3d29
    • Adrian Hunter's avatar
      perf report: Add Instruction Tracing support · 520a2ebc
      Adrian Hunter authored
      
      
      Add support for decoding an AUX area assuming it contains instruction
      tracing data.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1429903807-20559-4-git-send-email-adrian.hunter@intel.com
      [ Do not use -Z as an alternative to --itrace ]
      [ Fixed initialization of itrace_synth_opts struct fields on older gcc versions ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      520a2ebc
    • Adrian Hunter's avatar
      perf script: Always allow fields 'addr' and 'cpu' for auxtrace · 6d5cdd64
      Adrian Hunter authored
      
      
      If a file contains AUX area tracing data then always allow fields 'addr'
      and 'cpu' to be selected as options for perf script.  This is necessary
      because AUX area decoding may synthesize events with that information.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1429903807-20559-3-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6d5cdd64
    • Adrian Hunter's avatar
      perf evlist: Amend mmap ref counting for the AUX area mmap · b72e74d1
      Adrian Hunter authored
      
      
      Reference counting of the mmap buffer does not work correctly when there
      is an AUX area mmap also.
      
      In snapshot mode it is not easy to know if the AUX area mmap buffer
      contains usefull information. Equally the evlist does not know if the
      recording is in sanpshot mode anyway.
      
      Consequently, for now just assume the AUX area mmap always has data,
      which will just cause the mmap buffer to remain mmapped for the duration
      of the recording.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1429903807-20559-2-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b72e74d1
    • Naveen N. Rao's avatar
      perf probe ppc64le: Fixup function entry if using kallsyms lookup · 7b6ff0bd
      Naveen N. Rao authored
      
      
      On powerpc ABIv2, if no debug-info is found and we use kallsyms, we need
      to fixup the function entry to point to the local entry point. Use
      offset of 8 since current toolchains always generate 2 instructions (8
      bytes).
      
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/92253021e77a104b23b615c8c23bf9501dfe60bf.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7b6ff0bd
    • Naveen N. Rao's avatar
      perf probe ppc64le: Prefer symbol table lookup over DWARF · d5c2e2c1
      Naveen N. Rao authored
      
      
      Use symbol table lookups by default if DWARF is not necessary, since
      powerpc ABIv2 encodes local entry points in the symbol table and the
      function entry address in DWARF may not be appropriate for kprobes, as
      described here:
      
      https://sourceware.org/bugzilla/show_bug.cgi?id=17638
      
      "The DWARF address ranges deliberately include the *whole* function,
      both global and local entry points."
      ...
      "If you want to set probes on a local entry point, you should look up
      the symbol in the main symbol table (not DWARF), and check the st_other
      bits; they will indicate whether the function has a local entry point,
      and what its offset from the global entry point is.  Note that GDB does
      the same when setting a breakpoint on a function entry."
      
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/88a10e22f4aaba2aef812824ca4b10d7beeea012.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d5c2e2c1
    • Ananth N Mavinakayanahalli's avatar
      perf probe ppc64le: Fix ppc64 ABIv2 symbol decoding · c50fc0a4
      Ananth N Mavinakayanahalli authored
      
      
      ppc64 ELF ABIv2 has a Global Entry Point (GEP) and a Local Entry Point
      (LEP). For purposes of probing, we need the LEP - the offset to which is
      encoded in st_other.
      
      Signed-off-by: default avatarAnanth N Mavinakayanahalli <ananth@in.ibm.com>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/ab9cc5e2b9de4cbaaf50f6ef2346a6a81100bad1.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c50fc0a4
    • Naveen N. Rao's avatar
      perf probe ppc: Enable matching against dot symbols automatically · 031b84c4
      Naveen N. Rao authored
      
      
      Allow perf probe to work on ppc ABIv1 without the need to specify the
      leading dot '.' for functions. 'perf probe do_fork' works with this
      patch.
      
      We do this by changing how symbol name comparison works on ppc ABIv1 -
      we simply ignore and skip over the initial dot, if one exists, during
      symbol name comparison.
      
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/652a8f3bfa919bd02a1836a128370eaed59b4a34.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      031b84c4
    • Naveen N. Rao's avatar
      perf probe ppc: Use the right prefix when ignoring SyS symbols on ppc · fb6d5942
      Naveen N. Rao authored
      
      
      Use the proper prefix when ignoring SyS symbols on ppc ABIv1. While at
      it, generalize symbol selection so architectures can implement their own
      logic.
      
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/adf1f98b121ecaf292777fe5cc69fe1038feabce.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fb6d5942
    • Naveen N. Rao's avatar
      perf probe ppc: Fix symbol fixup issues due to ELF type · d2332098
      Naveen N. Rao authored
      
      
      If using the symbol table, symbol addresses are not being fixed up
      properly, resulting in probes being placed at wrong addresses:
      
        # perf probe do_fork
        Added new event:
          probe:do_fork        (on do_fork)
      
        You can now use it in all perf tools, such as:
      
      	  perf record -e probe:do_fork -aR sleep 1
      
        # cat /sys/kernel/debug/tracing/kprobe_events
        p:probe/do_fork _text+635952
        # printf "%x" 635952
        9b430
        # grep do_fork /boot/System.map
        c0000000000ab430 T .do_fork
      
      Fix by checking for ELF type ET_DYN used by ppc64 kernels.
      
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/41392bb856ef62d929995e0b61967689b7915207.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d2332098
    • Petr Holasek's avatar
      perf bench numa: Show more stats of particular threads in verbose mode · b64aa553
      Petr Holasek authored
      
      
      In verbose mode perf bench numa shows also GB/s speed, system and user cpu
      time for each particular thread. Using of getrusage() can provide much more
      per process or per thread stats in future.
      
      Signed-off-by: default avatarPetr Holasek <pholasek@redhat.com>
      Reviewed-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1429198699-25039-3-git-send-email-pholasek@redhat.com
      [ Rename 'usage' variable to not shadow util.h's usage() ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b64aa553
    • Will Deacon's avatar
      perf tools: Use getconf to determine number of online CPUs · 762abdc0
      Will Deacon authored
      
      
      Parsing /proc/cpuinfo is a fiddly, arch-dependent business and a recent
      change to get it working for Sparc broke arm and arm64 platforms.
      
      Use sysconf to determine the number of online CPUs only parsing
      /proc/cpuinfo when sysconf is not available.
      
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <david.ahern@oracle.com>
      Cc: Mark Rutland <Mark.Rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/20150423140454.GJ1652@arm.com
      [ Made it fall back to parsing /proc when getconf not found ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      762abdc0
  4. Apr 29, 2015