1. 07 Jun, 2018 10 commits
    • Jiri Olsa's avatar
      perf stat: Allow to specify specific metric column len · c1a1f5d9
      Jiri Olsa authored
      The following change will introduce new metrics, that doesn't need such
      wide hard coded spacing. Switch METRIC_ONLY_LEN macro usage with
      metric_only_len variable.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <frederic@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/20180606221513.11302-7-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c1a1f5d9
    • Jiri Olsa's avatar
      perf stat: Fix metric column header display alignment · f5155727
      Jiri Olsa authored
      Make the metric only display aligned.
      
      Before:
        # perf stat --topdown -I 1000
        #           time core         cpus retiring             bad speculation      frontend bound       backend bound
             1.000394323 S0-C0           2     37.4%               12.0%               31.4%               19.2%
             1.000394323 S0-C1           2     25.1%                9.2%               43.8%               21.9%
             2.001521204 S0-C0           2     36.4%               11.4%               32.4%               19.8%
             2.001521204 S0-C1           2     26.2%                9.4%               43.1%               21.3%
             3.001930208 S0-C0           2     35.1%               10.7%               33.6%               20.6%
             3.001930208 S0-C1           2     28.9%               10.0%               40.0%               21.1%
      
      After:
        # perf stat --topdown -I 1000
        #           time core         cpus             retiring      bad speculation       frontend bound        backend bound
             1.000303722 S0-C0           2                34.2%                 7.6%                34.2%                24.0%
             1.000303722 S0-C1           2                33.1%                 6.4%                36.9%                23.6%
             2.001281055 S0-C0           2                34.6%                 6.7%                36.8%                21.8%
             2.001281055 S0-C1           2                32.8%                 7.1%                38.1%                22.0%
             3.001546080 S0-C0           2                39.3%                 5.5%                32.7%                22.5%
             3.001546080 S0-C1           2                37.8%                 6.0%                33.1%                23.1%
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <frederic@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/20180606221513.11302-6-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f5155727
    • Jiri Olsa's avatar
      perf stat: Use only color_fprintf call in print_metric_only · b37d33ed
      Jiri Olsa authored
      We can call color_fprintf also for non color case, it's handled
      properly. This change simplifies following patch.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <frederic@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/20180606221513.11302-5-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b37d33ed
    • Jiri Olsa's avatar
      perf stat: Add --interval-clear option · 9660e08e
      Jiri Olsa authored
      Adding --interval-clear option to clear the screen before next interval.
      
      Committer testing:
      
        # perf stat -I 1000 --interval-clear
      
      And, as expected, it behaves almost like:
      
        # watch -n 0 perf stat -a sleep 1
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <frederic@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/20180606221513.11302-4-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9660e08e
    • Jiri Olsa's avatar
      perf tools: Fix error index for pmu event parser · f7fa827f
      Jiri Olsa authored
      For events we provide specific error message we need to set error column
      index, PMU parser is missing that, adding it.
      
      Before:
      
        $ perf stat -e cycles,krava/cycles/ kill
        event syntax error: 'cycles,krava/cycles/'
                             \___ Cannot find PMU `krava'. Missing kernel support?
      
      After:
      
        $ perf stat -e cycles,krava/cycles/ kill
        event syntax error: 'cycles,krava/cycles/'
                                    \___ Cannot find PMU `krava'. Missing kernel support?
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <frederic@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/20180606221513.11302-3-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f7fa827f
    • Arnaldo Carvalho de Melo's avatar
      perf hists: Reimplement hists__has_callchains() · c9d36628
      Arnaldo Carvalho de Melo authored
      There are places where we have only access to struct hists and need to
      know if any of its hist_entries has callchains, like when drawing
      headers for the various output modes (stdio, TUI, etc), so, when adding
      a new hist_entry, check if it has callchains, storing this info for
      later use by hists__has_callchains().
      
      This reimplementation is necessary because not always a 'struct hists'
      is allocated together with a 'struct perf evsel', so we can't go from
      'hists' to 'perf_event_attr.sample_type & PERF_SAMPLE_CALLCHAIN'.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-hg5g7yddjio3ljwyqnnaj5dt@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c9d36628
    • Arnaldo Carvalho de Melo's avatar
      perf hists browser gtk: Use hist_entry__has_callchains() · 29f9fcdd
      Arnaldo Carvalho de Melo authored
      Since we can't go from struct hists to struct evsel for all cases (c2c
      is an exception) and we have access to the hist_entry, use
      hist_entry__has_callchains() in the GTK+ hists browser to figure out
      if callchains are available.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-8owkgrruzzi5emvblwh4e6le@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      29f9fcdd
    • Arnaldo Carvalho de Melo's avatar
      perf hists: Make hist_entry__has_callchains() work with 'perf c2c' · e5654455
      Arnaldo Carvalho de Melo authored
      Since 'perf c2c' uses 'struct hists' not allocated together with a
      'struct perf_evsel' instance, we can't go from a 'struct hist_entry'
      pointer to a 'struct perf_evsel' via he->hists, so, instead, check if
      space was set aside for hist_entry->callchain[0] at hist_entry__new()
      time.
      Reported-by: default avatarJin Yao <yao.jin@linux.intel.com>
      Reported-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: fabd37b8 ("perf hists: Check if a hist_entry has callchains before using them")
      Link: https://lkml.kernel.org/n/tip-e8ife8djvvvwmeze3s4yodii@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e5654455
    • Arnaldo Carvalho de Melo's avatar
      perf hists: Save the callchain_size in struct hist_entry · 41477acf
      Arnaldo Carvalho de Melo authored
      So that we can figure out the real size of the struct and also be able
      to tell if callchains may be present in this histogram entry.
      
      Since we can't always guarantee that from hist_entry->hists we can use
      hists_to_evsel, to then look at evsel->attr.sample_type for
      PERF_SAMPLE_CALLCHAIN, like with the 'perf c2c' tool, that uses plain
      'struct hists' instances, we need another way of deciding if a specific
      hist_entry instance has callchains associated with it, i.e. if its
      hist_entry->callchain[0] has space allocated for.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-ptvndealxs1k7myluvu9flnq@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      41477acf
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-4.18-20180606' of... · 2696ec45
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-4.18-20180606' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      perf stat:
      
       - Display user and system time for workload targets (Jiri Olsa)
      
      perf record:
      
       - Enable arbitrary event names thru name= modifier (Alexey Budankov)
      
      PowerPC:
      
       - Add a python script for hypervisor call statistics (Ravi Bangoria)
      
      Intel PT: (Adrian Hunter)
      
       - Fix sync_switch INTEL_PT_SS_NOT_TRACING
      
       - Fix decoding to accept CBR between FUP and corresponding TIP
      
       - Fix MTC timing after overflow
      
       - Fix "Unexpected indirect branch" error
      
      perf test:
      
       - record+probe_libc_inet_pton:
      
        -  To get the symbol table for dynamic
           shared objects on ubuntu we need to pass the -D/--dynamic command line
           option, unlike with the fedora distros (Arnaldo Carvalho de Melo)
      
       - code-reading:
      
        - Fix perf_env setup for PTI entry trampolines (Adrian Hunter)
      
       - kmod-path:
      
        - Add tests for vdso32 and vdsox32 (Adrian Hunter)
      
       - Use header file util/debug.h (Thomas Richter)
      
      perf annotate:
      
       - Make the various UI backends (stdio, TUI, gtk) use more consistently
        structs with annotation options as specified by the user (Arnaldo Carvalho de Melo)
      
       - Move annotation specific knobs from the symbol_conf global kitchen
        sink to the annotation option structs (Arnaldo Carvalho de Melo)
      
      perf script:
      
       - Add more PMU fields to python scripts event handler dict (Jin Yao)
      
      Core:
      
       - Fix misleading error for some unparsable events mentioning PMUs when
        those are not involved in the problem (Jiri Olsa)
      
       - Consider BSS symbols when processing /proc/kallsyms ('B' and 'b')
        (Arnaldo Carvalho de Melo)
      
      - Be more robust when trying to use per-symbol histograms, checking for
        unlikely but possible cases where the space for the histograms wasn't
        allocated, print a debug message for such cases (Arnaldo Carvalho de Melo)
      
      - Fix symbol and object code resolution for vdso32 and vdsox32 (Adrian Hunter)
      
       - No need to check for null when passing pointers to foo__get() style
        refcount grabbing helpers, just like in the kernel and with free(),
        its safe to pass a NULL pointer to avoid having to check it before
        each and every foo__get() call (Arnaldo Carvalho de Melo)
      
       - Remove some dead code (quote.[ch]) (Arnaldo Carvalho de Melo)
      
       - Remove some needless globals, making them local (Arnaldo Carvalho de Melo)
      
       - Reduce usage of symbol_conf.use_callchain, using other means of
        finding out if callchains are in use or available for specific events,
        as we evolved this codebase to allow requesting callchains for just
        a subset of the monitored events. In time it will help polish
        recording and showing mixed sets accross the various tools:
      
          perf record -e cycles/call-graph=fp/,cache-misses/call-graph=dwarf/,instructions'
      
        (Arnaldo Carvalho de Melo)
      
       - Consider PTI entry trampolines in map__rip_2objdump() (Adrian Hunter)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      2696ec45
  2. 06 Jun, 2018 20 commits
  3. 05 Jun, 2018 10 commits