1. 05 Dec, 2017 20 commits
  2. 30 Nov, 2017 1 commit
  3. 29 Nov, 2017 12 commits
    • Arnaldo Carvalho de Melo's avatar
    • Adrian Hunter's avatar
      perf intel-pt: Improve build messages for files that differ from the kernel · c2653297
      Adrian Hunter authored
      Print file names of files that differ. For example, instead of:
      
        Warning: Intel PT: x86 instruction decoder differs from kernel
      
      print:
      
        Warning: Intel PT: x86 instruction decoder header at 'tools/perf/util/intel-pt-decoder/inat.h' differs from latest version at 'arch/x86/include/asm/inat.h'
      Reported-by: default avatarIngo Molnar <mingo@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Link: http://lkml.kernel.org/r/1511253326-22308-2-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c2653297
    • Arnaldo Carvalho de Melo's avatar
      perf report: Fix -D output for user metadata events · f250b09c
      Arnaldo Carvalho de Melo authored
      The PERF_RECORD_USER_ events are synthesized by the tool to assist in
      processing the PERF_RECORD_ ones generated by the kernel, the printing
      of that information doesn't come with a perf_sample structure, so, when
      dumping the event fields using 'perf report -D' there were columns that
      end up not being printed.
      
      To tidy up a bit this, fake a perf_sample structure with zeroes to have
      the missing columns printed and avoid the occasional surprise with that.
      
      Before:
      
      0 0x45b8 [0x68]: PERF_RECORD_MMAP -1/0: [0xffffffffc12ec000(0x4000) @ 0]: x /lib/modules/4.14.0+/kernel/fs/nls/nls_utf8.ko
      0x4620 [0x28]: PERF_RECORD_THREAD_MAP nr: 1 thread: 27820
      0x4648 [0x18]: PERF_RECORD_CPU_MAP: 0-3
      0 0x4660 [0x28]: PERF_RECORD_COMM: perf:27820/27820
      0x4a58 [0x8]: PERF_RECORD_FINISHED_ROUND
      447723433020976 0x4688 [0x28]: PERF_RECORD_SAMPLE(IP, 0x4001): 27820/27820: 0xffffffff8f1b6d7a period: 1 addr: 0
      
      After:
      
        $ perf report -D | grep PERF_RECORD_ | head
        0 0xe8 [0x20]: PERF_RECORD_TIME_CONV: unhandled!
        0 0x108 [0x28]: PERF_RECORD_THREAD_MAP nr: 1 thread: 32555
        0 0x130 [0x18]: PERF_RECORD_CPU_MAP: 0-3
        0 0x148 [0x28]: PERF_RECORD_COMM: perf:32555/32555
        0 0x4e8 [0x8]: PERF_RECORD_FINISHED_ROUND
        448743409421205 0x170 [0x28]: PERF_RECORD_COMM exec: sleep:32555/32555
        448743409431883 0x198 [0x68]: PERF_RECORD_MMAP2 32555/32555: [0x55e11d75a000(0x208000) @ 0 fd:00 3147174 2566255743]: r-xp /usr/bin/sleep
        448743409443873 0x200 [0x70]: PERF_RECORD_MMAP2 32555/32555: [0x7f0ced316000(0x229000) @ 0 fd:00 3151761 2566238119]: r-xp /usr/lib64/ld-2.25.so
        448743409454790 0x270 [0x60]: PERF_RECORD_MMAP2 32555/32555: [0x7ffe84f6d000(0x2000) @ 0 00:00 0 0]: r-xp [vdso]
        448743409479500 0x2d0 [0x28]: PERF_RECORD_SAMPLE(IP, 0x4002): 32555/32555: 0xffffffff8f84c7e7 period: 1 addr: 0
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: 9aefcab0 ("perf session: Consolidate the dump code")
      Link: https://lkml.kernel.org/n/tip-todcu15x0cwgppkh1gi6uhru@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f250b09c
    • Hansuk Hong's avatar
      perf buildid-cache: Document for Node.js USDT · 2e38e661
      Hansuk Hong authored
      Add a tip for Node.js USDT(User-Level Statically Defined Tracing) probes
      in tips.txt
      Signed-off-by: default avatarHansuk Hong <flavono123@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/20171123160546.9722-1-flavono123@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2e38e661
    • Andi Kleen's avatar
      perf script: Allow computing 'perf stat' style metrics · 4bd1bef8
      Andi Kleen authored
      Add support for computing 'perf stat' style metrics in 'perf script'.
      
      When using leader sampling we can get metrics for each sampling period
      by computing formulas over the values of the different group members.
      
      This allows things like fine grained IPC tracking through sampling, much
      more fine grained than with 'perf stat'.
      
      The metric is still averaged over the sampling period, it is not just
      for the sampling point.
      
      This patch adds a new metric output field for 'perf script' that uses
      the existing 'perf stat' metrics infrastructure to compute any metrics
      supported by 'perf stat'.
      
      For example to sample IPC:
      
        $ perf record -e '{ref-cycles,cycles,instructions}:S' -a sleep 1
        $ perf script -F metric,ip,sym,time,cpu,comm
        ...
         alsa-sink-ALC32 [000] 42815.856074:      7fd65937d6cc [unknown]
         alsa-sink-ALC32 [000] 42815.856074:      7fd65937d6cc [unknown]
         alsa-sink-ALC32 [000] 42815.856074:      7fd65937d6cc [unknown]
         alsa-sink-ALC32 [000] 42815.856074:    metric:    0.13  insn per cycle
                 swapper [000] 42815.857961:  ffffffff81655df0 __schedule
                 swapper [000] 42815.857961:  ffffffff81655df0 __schedule
                 swapper [000] 42815.857961:  ffffffff81655df0 __schedule
                 swapper [000] 42815.857961:    metric:    0.23  insn per cycle
         qemu-system-x86 [000] 42815.858130:  ffffffff8165ad0e _raw_spin_unlock_irqrestore
         qemu-system-x86 [000] 42815.858130:  ffffffff8165ad0e _raw_spin_unlock_irqrestore
         qemu-system-x86 [000] 42815.858130:  ffffffff8165ad0e _raw_spin_unlock_irqrestore
         qemu-system-x86 [000] 42815.858130:    metric:    0.46  insn per cycle
                   :4972 [000] 42815.858312:  ffffffffa080e5f2 vmx_vcpu_run
                   :4972 [000] 42815.858312:  ffffffffa080e5f2 vmx_vcpu_run
                   :4972 [000] 42815.858312:  ffffffffa080e5f2 vmx_vcpu_run
                   :4972 [000] 42815.858312:    metric:    0.45  insn per cycle
      
      TopDown:
      
      This requires disabling SMT if you have it enabled, because SMT would
      require sampling per core, which is not supported.
      
        $ perf record -e '{ref-cycles,topdown-fetch-bubbles,\
                           topdown-recovery-bubbles,\
                           topdown-slots-retired,topdown-total-slots,\
                           topdown-slots-issued}:S' -a sleep 1
        $ perf script --header -I -F cpu,ip,sym,event,metric,period
        ...
        [000]     121108               ref-cycles:  ffffffff8165222e copy_user_enhanced_fast_string
        [000]     190350    topdown-fetch-bubbles:  ffffffff8165222e copy_user_enhanced_fast_string
        [000]       2055 topdown-recovery-bubbles:  ffffffff8165222e copy_user_enhanced_fast_string
        [000]     148729    topdown-slots-retired:  ffffffff8165222e copy_user_enhanced_fast_string
        [000]     144324      topdown-total-slots:  ffffffff8165222e copy_user_enhanced_fast_string
        [000]     160852     topdown-slots-issued:  ffffffff8165222e copy_user_enhanced_fast_string
        [000]   metric:     33.0% frontend bound
        [000]   metric:      3.5% bad speculation
        [000]   metric:     25.8% retiring
        [000]   metric:     37.7% backend bound
        [000]     112112               ref-cycles:  ffffffff8165aec8 _raw_spin_lock_irqsave
        [000]     357222    topdown-fetch-bubbles:  ffffffff8165aec8 _raw_spin_lock_irqsave
        [000]       3325 topdown-recovery-bubbles:  ffffffff8165aec8 _raw_spin_lock_irqsave
        [000]     323553    topdown-slots-retired:  ffffffff8165aec8 _raw_spin_lock_irqsave
        [000]     270507      topdown-total-slots:  ffffffff8165aec8 _raw_spin_lock_irqsave
        [000]     341226     topdown-slots-issued:  ffffffff8165aec8 _raw_spin_lock_irqsave
        [000]   metric:     33.0% frontend bound
        [000]   metric:      2.9% bad speculation
        [000]   metric:     29.9% retiring
        [000]   metric:     34.2% backend bound
      ...
      
      v2:
      Use evsel->priv for new fields
      Port to new base line, support fp output.
      Handle stats in ->stats, not ->priv
      Minor cleanups
      
      Extra explanation about the use of the term 'averaging', from Andi in the
      thread in the Link: tag below:
      
      <quote Andi>
      The current samples contains the sum of event counts for a sampling period.
      
      EventA-1           EventA-2                EventA-3      EventA-4
      EventB-1     EventB-2                             EventC-3
      
                               gap with no events                overflow
      |-----------------------------------------------------------------|
      period-start                                             period-end
      ^                                                                 ^
      |                                                                 |
      previous sample                                      current sample
      
      So EventA = 4 and EventB = 3 at the sample point
      
      I generate a metric, let's say EventA / EventB. It applies to the whole period.
      
      But the metric is over a longer time which does not have the same behavior. For
      example the gap above doesn't have any events, while they are clustered at the
      beginning and end of the sample period.
      
      But we're summing everything together. The metric doesn't know that the gap is
      different than the busy period.
      
      That's what I'm trying to express with averaging.
      </quote>
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20171117214300.32746-4-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4bd1bef8
    • Andi Kleen's avatar
      perf record: Synthesize thread map and cpu map · 373565d2
      Andi Kleen authored
      Synthesize the per attr thread maps and cpu maps in 'perf record'.
      
      This allows code from 'perf stat' called from 'perf script' to access
      this information.
      
      Committer testing:
      
      Please see the PERF_RECORD_THREAD_MAP and PERF_RECORD_CPU_MAP records,
      added by this patch:
      
        $ perf record sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.001 MB perf.data (8 samples) ]
        $ perf report -D | grep PERF_RECORD_ | head
        0xe8 [0x20]: PERF_RECORD_TIME_CONV: unhandled!
        0x108 [0x28]: PERF_RECORD_THREAD_MAP nr: 1 thread: 23568
        0x130 [0x18]: PERF_RECORD_CPU_MAP: 0-3
        0 0x148 [0x28]: PERF_RECORD_COMM: perf:23568/23568
        0x570 [0x8]: PERF_RECORD_FINISHED_ROUND
        445342677837144 0x170 [0x28]: PERF_RECORD_COMM exec: sleep:23568/23568
        445342677847339 0x198 [0x68]: PERF_RECORD_MMAP2 23568/23568: [0x564c943a4000(0x208000) @ 0 fd:00 3147174 2566255743]: r-xp /usr/bin/sleep
        445342677862450 0x200 [0x70]: PERF_RECORD_MMAP2 23568/23568: [0x7f25968a8000(0x229000) @ 0 fd:00 3151761 2566238119]: r-xp /usr/lib64/ld-2.25.so
        445342677873174 0x270 [0x60]: PERF_RECORD_MMAP2 23568/23568: [0x7ffc98176000(0x2000) @ 0 00:00 0 0]: r-xp [vdso]
        445342677891928 0x2d0 [0x28]: PERF_RECORD_SAMPLE(IP, 0x4002): 23568/23568: 0xffffffff8f84c7e7 period: 1 addr: 0
        $
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Link: http://lkml.kernel.org/r/20171117214300.32746-3-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      373565d2
    • Andi Kleen's avatar
      perf record: Synthesize unit/scale/... in event update · bfd8f72c
      Andi Kleen authored
      Move the code to synthesize event updates for scale/unit/cpus to a
      common utility file, and use it both from stat and record.
      
      This allows to access scale and other extra qualifiers from perf script.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20171117214300.32746-2-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bfd8f72c
    • Thomas Richter's avatar
      perf test: Disable test cases 19 and 20 on s390x · 4ca69ca9
      Thomas Richter authored
      The s390x CPU sampling and measurement facilities do not support perf
      events of type PERF_TYPE_BREAKPOINT. The test cases are executed and
      fail with -ENOENT due to missing hardware support.
      
      Disable the execution of both test cases based on a
      platform check. This is the same approach as done for
      PowerPC.
      Signed-off-by: default avatarThomas Richter <tmricht@linux.vnet.ibm.com>
      Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      LPU-Reference: 20171123074623.20817-1-tmricht@linux.vnet.ibm.com
      Link: https://lkml.kernel.org/n/tip-uqvoy6a1tsu8jddo5jjg4h85@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4ca69ca9
    • Ingo Molnar's avatar
      tools headers: Follow the upstream UAPI header version 100% differ from the kernel · 3f27bb5f
      Ingo Molnar authored
      Remove this from check-headers.sh:
      
        opts="--ignore-blank-lines --ignore-space-change"
      
      as the easiest policy is to just follow the upstream UAPI header version 100%.
      Pure space-only changes are comparatively rare.
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Link: http://lkml.kernel.org/r/20171121084111.y6p5zwqso2cbms5s@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3f27bb5f
    • Ingo Molnar's avatar
      e4f57147
    • Ingo Molnar's avatar
      Merge branch 'perf/urgent' of... · 6e948c67
      Ingo Molnar authored
      Merge branch 'perf/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf tooling fixes from Arnaldo Carvalho de Melo:
      
      "- Fix window dimensions change handling in 'perf top' (Jiri Olsa)
      
      - Fix 'perf record -c/-F' options for CPU event aliases (Andi Kleen)
      
      - Generate PERF_RECORD_{MMAP,COMM,EXEC} with 'perf record --delay'
        fixing symbol resolution for processes created, maps put in place
        while --delay happens (Arnaldo Carvalho de Melo)
      
      - Fix up leftover perf_evsel_stat usage via evsel->priv, plugging
        a SEGV when using event groups as in:
      
           $ perf stat -e '{cpu-clock,instructions}' workload
      
      - Fix 'perf script --per-event-dump' for auxtrace synth evsels (Arnaldo Carvalho de Melo)
      
      - Ignore kptr_restrict when not sampling the kernel (Arnaldo Carvalho de Melo)
      
      - Synchronize kernel ABI headers wrt SPDX tags and ABI changes,
        taking minimal action to handle new syscall args and silencing
        perf build warnings (Arnaldo Carvalho de Melo, Ingo Molnar)
      
      - Fix header.size for namespace events (Jiri Olsa)
      
      - Fix a bug during strstart() conversion in 'perf help' (Namhyung Kim)
      
      - Do not truncate instruction names at 6 chars in 'perf annotate', there
        are really long instruction names in PPC (Ravi Bangoria)
      
      - Fixup discontiguous/sparse numa nodes in 'perf bench numa' (Satheesh Rajendran)
      
      - Fix an exit code of trace__symbols_init in 'perf trace' (Andrei Vagin)
      
      - Fix 'perf test' entries on s/390 (Thomas Richter)
      
      - Bring instruction decoder files used by Intel PT into line with the kernel,
        silencing build warning (Adrian Hunter)"
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      6e948c67
    • Ingo Molnar's avatar
  4. 28 Nov, 2017 7 commits