1. 12 1月, 2016 2 次提交
  2. 11 1月, 2016 4 次提交
  3. 10 1月, 2016 1 次提交
    • I
      Merge tag 'perf-core-for-mingo' of... · 3eb9ede2
      Ingo Molnar 提交于
      Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      New features:
      
      - Allow using trace events fields as sort order keys, making 'perf evlist --trace_fields'
        show those, and then the user can select a subset and use like:
      
          perf top -e sched:sched_switch -s prev_comm,next_comm
      
        That works as well in 'perf report' when handling files containing
        tracepoints.
      
        The default when just tracepoint events are found in a perf.data file is to
        format it like ftrace, using the libtraceevent formatters, plugins, etc (Namhyung Kim)
      
      - Add support in 'perf script' to process 'perf stat record' generated files,
        culminating in a python perf script that calculates CPI (Cycles per
        Instruction) (Jiri Olsa)
      
      - Show random perf tool tips in the 'perf report' bottom line (Namhyung Kim)
      
      - perf report now defaults to --group if the perf.data file has grouped events, try it with:
      
        # perf record -e '{cycles,instructions}' -a sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 1.093 MB perf.data (1247 samples) ]
        # perf report
        # Samples: 1K of event 'anon group { cycles, instructions }'
        # Event count (approx.): 1955219195
        #
        #       Overhead  Command     Shared Object      Symbol
      
           2.86%   0.22%  swapper     [kernel.kallsyms]  [k] intel_idle
           1.05%   0.33%  firefox     libxul.so          [.] js::SetObjectElement
           1.05%   0.00%  kworker/0:3 [kernel.kallsyms]  [k] gen6_ring_get_seqno
           0.88%   0.17%  chrome      chrome             [.] 0x0000000000ee27ab
           0.65%   0.86%  firefox     libxul.so          [.] js::ValueToId<(js::AllowGC)1>
           0.64%   0.23%  JS Helper   libxul.so          [.] js::SplayTree<js::jit::LiveRange*, js::jit::LiveRange>::splay
           0.62%   1.27%  firefox     libxul.so          [.] js::GetIterator
           0.61%   1.74%  firefox     libxul.so          [.] js::NativeSetProperty
           0.61%   0.31%  firefox     libxul.so          [.] js::SetPropertyByDefining
      
      User visible fixes:
      
      - Coect data mmaps so that the DWARF unwinder can handle usecases needing them,
        like softice (Jiri Olsa)
      
      - Decay callchains in fractal mode, fixing up cases where 'perf top -g' would
        show entries with more than 100% (Namhyung Kim)
      
      Infrastructure changes:
      
      - Sync tools/lib with the lib/ in the kernel sources for find_bit.c and
        move bitmap.[ch] from tools/perf/util/ to tools/lib/ (Arnaldo Carvalho de Melo)
      
      - No need to set attr.sample_freq in some 'perf test' entries that only
        want to deal with PERF_RECORD_ meta-events, improve a bit error output
        for CQM test (Arnaldo Carvalho de Melo)
      
      - Fix python binding build, adding some missing object files now required
        due to cpumap using find_bit stuff (Arnaldo Carvalho de Melo)
      
      - tools/build improvemnts (Jiri Olsa)
      
      - Add more files to cscope/ctags databases (Jiri Olsa)
      
      - Do not show 'trace' in 'perf help' if it is not compiled in (Jiri Olsa)
      
      - Make perf_evlist__open() open evsels with their cpus and threads,
        like perf record does, making them consistent (Adrian Hunter)
      
      - Fix pmu snapshot initialization bug (Stephane Eranian)
      
      - Add missing headers in perf's MANIFEST (Wang Nan)
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      3eb9ede2
  4. 09 1月, 2016 8 次提交
  5. 08 1月, 2016 19 次提交
  6. 07 1月, 2016 6 次提交
    • A
      perf tests: No need to set attr.sample_freq in the perf time to TSC test · 4f4ba0e6
      Arnaldo Carvalho de Melo 提交于
      We were asking for a 4kHz sample_freq, making the test fail needlessly
      when the system reduced /proc/sys/kernel/perf_event_max_sample_rate
      below that.
      
      In this test we only look at the PERF_SAMPLE_TIME fields in PERF_RECORD_
      meta events, no need to set sample_freq.
      
      Thanks to Namhyung for suggesting that max_sample_rate could be the
      reason for the test failure, seeing the 'perf test -vv' output I sent.
      
      Before:
      
        # echo 1000 > /proc/sys/kernel/perf_event_max_sample_rate
        # perf test TSC
        45: Test converting perf time to TSC   : FAILED!
      
      After:
      
        # perf test TSC
        45: Test converting perf time to TSC   : Ok
        # cat /proc/sys/kernel/perf_event_max_sample_rate
        1000
      
      Cc: Adrian Hunter <adrian.hunter@intel.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>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-lcob05qhawkuvsyuu9g1fld5@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4f4ba0e6
    • S
      perf pmu: fix alias->snapshot missing initialization bug · 84530920
      Stephane Eranian 提交于
      This patch fixes a bug in __perf_pmu__new_alias() whereby the
      alias->snapshot field was not initialized to false. This led to random
      alias->snapshot value for an alias and was breaking some measurements
      such as:
      
        $ perf stat -a -e uncore_imc/data_reads/ -I 1000 sleep 100
      
      Because the event ended up being treated as snapshot mode, when it is
      not.
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1452106201-13073-1-git-send-email-eranian@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      84530920
    • J
      perf script: Add stat-cpi.py script · b8a1962d
      Jiri Olsa 提交于
      Adding stat-cpi.py as an example of how to do stat scripting.
      
      It computes the CPI metrics from cycles and instructions events.
      
      The CPI is based performance metric showing the Cycles Per Instructions
      ratio, which helps to identify cycles-hungry code.
      
      Following stat record/report/script combinations could be used:
      
      - get CPI for given workload
      
          $ perf stat -e cycles,instructions record ls
      
          SNIP
      
           Performance counter stats for 'ls':
      
                   2,904,431      cycles
                   3,346,878      instructions              #    1.15  insns per cycle
      
                 0.001782686 seconds time elapsed
      
          $ perf script -s ./scripts/python/stat-cpi.py
                 0.001783: cpu -1, thread -1 -> cpi 0.867803 (2904431/3346878)
      
          $ perf stat -e cycles,instructions record ls | perf script -s ./scripts/python/stat-cpi.py
      
          SNIP
      
                 0.001730: cpu -1, thread -1 -> cpi 0.869026 (2928292/3369627)
      
      - get CPI systemwide:
      
          $ perf stat -e cycles,instructions -a -I 1000 record sleep 3
          #           time             counts unit events
               1.000158618        594,274,711      cycles                     (100.00%)
               1.000158618        441,898,250      instructions
               2.000350973        567,649,705      cycles                     (100.00%)
               2.000350973        432,669,206      instructions
               3.000559210        561,940,430      cycles                     (100.00%)
               3.000559210        420,403,465      instructions
               3.000670798            780,105      cycles                     (100.00%)
               3.000670798            326,516      instructions
      
          $ perf script -s ./scripts/python/stat-cpi.py
                 1.000159: cpu -1, thread -1 -> cpi 1.344823 (594274711/441898250)
                 2.000351: cpu -1, thread -1 -> cpi 1.311972 (567649705/432669206)
                 3.000559: cpu -1, thread -1 -> cpi 1.336669 (561940430/420403465)
                 3.000671: cpu -1, thread -1 -> cpi 2.389178 (780105/326516)
      
          $ perf stat -e cycles,instructions -a -I 1000 record sleep 3 | perf script -s ./scripts/python/stat-cpi.py
                 1.000202: cpu -1, thread -1 -> cpi 1.035091 (940778881/908885530)
                 2.000392: cpu -1, thread -1 -> cpi 1.442600 (627493992/434974455)
                 3.000545: cpu -1, thread -1 -> cpi 1.353612 (741463930/547766890)
                 3.000622: cpu -1, thread -1 -> cpi 2.642110 (784083/296764)
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: NKan Liang <kan.liang@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1452077397-31958-4-git-send-email-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b8a1962d
    • J
      perf script: Display stat events by default · 36e33c53
      Jiri Olsa 提交于
      If no script is specified for stat data, display stat events in raw
      form.
      
        $ perf stat record ls
      
        SNIP
      
         Performance counter stats for 'ls':
      
                  0.851585      task-clock (msec)         #    0.717 CPUs utilized
                         0      context-switches          #    0.000 K/sec
                         0      cpu-migrations            #    0.000 K/sec
                       114      page-faults               #    0.134 M/sec
                 2,620,918      cycles                    #    3.078 GHz
           <not supported>      stalled-cycles-frontend
           <not supported>      stalled-cycles-backend
                 2,714,111      instructions              #    1.04  insns per cycle
                   542,434      branches                  #  636.970 M/sec
                    15,946      branch-misses             #    2.94% of all branches
      
               0.001186954 seconds time elapsed
      
        $ perf script
        CPU   THREAD             VAL             ENA             RUN            TIME EVENT
         -1    26185          851585          851585          851585         1186954 task-clock
         -1    26185               0          851585          851585         1186954 context-switches
         -1    26185               0          851585          851585         1186954 cpu-migrations
         -1    26185             114          851585          851585         1186954 page-faults
         -1    26185         2620918          853340          853340         1186954 cycles
         -1    26185               0               0               0         1186954 stalled-cycles-frontend
         -1    26185               0               0               0         1186954 stalled-cycles-backend
         -1    26185         2714111          853340          853340         1186954 instructions
         -1    26185          542434          853340          853340         1186954 branches
         -1    26185           15946          853340          853340         1186954 branch-misses
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: NKan Liang <kan.liang@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1452077397-31958-3-git-send-email-jolsa@kernel.org
      [ Rename 'time' parameter to 'tstamp' to fix build on older distros ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      36e33c53
    • J
      perf cpumap: Fix cpu conversion in cpu_map__from_entries · 15d2b995
      Jiri Olsa 提交于
      We can't convert u16 cpu_map_entries::cpu[x] value directly to int,
      because it could hold -1, which would be converted as 65535.
      
      Adding special treatment for -1, which is not real cpu number, to be
      converted to (int -1).
      Reported-by: NArnaldo Carvalho de Melo <acme@kernel.org>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1452077397-31958-2-git-send-email-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      15d2b995
    • J
      perf script: Add python support for stat events · aef90263
      Jiri Olsa 提交于
      Add support to get stat events data in perf python scripts.
      
      The python script shall implement the following new interface to process
      stat data:
      
        def stat__<event_name>_[<modifier>](cpu, thread, time, val, ena, run):
      
          - is called for every stat event for given counter,
            if user monitors 'cycles,instructions:u" following
            callbacks should be defined:
      
            def stat__cycles(cpu, thread, time, val, ena, run):
            def stat__instructions_u(cpu, thread, time, val, ena, run):
      
        def stat__interval(time):
      
          - is called for every interval with its time,
            in non interval mode it's called after last
            stat event with total measured time in ns
      
      The rest of the current interface stays untouched..
      
      Please check example CPI metrics script in following patch
      with command line examples in changelogs.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NKan Liang <kan.liang@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1452028152-26762-8-git-send-email-jolsa@kernel.org
      [ Rename 'time' parameters to 'tstamp', to fix the build in older distros ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      aef90263