15 Feb, 2017

2 commits

  • commit 8381cdd0e32dd748bd34ca3ace476949948bd793 upstream.

    The -o/--order option is to select column number to sort a diff result.

    It does the job by adding a hpp field at the beginning of the sort list.
    But it should not be added to the output field list as it has no
    callbacks required by a output field.

    During the setup_sorting(), the perf_hpp__setup_output_field() appends
    the given sort keys to the output field if it's not there already.

    Originally it was checked by fmt->list being non-empty. But commit
    3f931f2c4274 ("perf hists: Make hpp setup function generic") changed it
    to check the ->equal callback.

    Anyways, we don't need to add the pseudo hpp field to the output field
    list since it won't be used for output. So just skip fields if they
    have no ->color or ->entry callbacks.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: Peter Zijlstra
    Fixes: 3f931f2c4274 ("perf hists: Make hpp setup function generic")
    Link: http://lkml.kernel.org/r/20170118051457.30946-1-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Namhyung Kim
     
  • commit a1c9f97f0b64e6337d9cfcc08c134450934fdd90 upstream.

    Commit 21e6d8428664 ("perf diff: Use perf_hpp__register_sort_field
    interface") changed list_add() to perf_hpp__register_sort_field().

    This resulted in a behavior change since the field was added to the tail
    instead of the head. So the -o option is mostly ignored due to its
    order in the list.

    This patch fixes it by adding perf_hpp__prepend_sort_field().

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: Peter Zijlstra
    Fixes: 21e6d8428664 ("perf diff: Use perf_hpp__register_sort_field interface")
    Link: http://lkml.kernel.org/r/20170118051457.30946-2-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Namhyung Kim
     

26 Jan, 2017

7 commits

  • commit 621cb4e7837e39d25a5af5a785ad282cdd2b4ce8 upstream.

    This patch modifies the build dependencies on the jitdump support in
    perf. As it stands jitdump was wrongfully made dependent 100% on using
    DWARF. However, the dwarf dependency, only exist if generating the
    source line table in genelf_debug.c. The rest of the support does not
    need DWARF.

    This patch removes the dependency on DWARF for the entire jitdump
    support. It keeps it only for the genelf_debug.c support.

    Signed-off-by: Maciej Debski
    Reviewed-by: Stephane Eranian
    Cc: Anton Blanchard
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1476356383-30100-3-git-send-email-eranian@google.com
    Fixes: e12b202f8fb9 ("perf jitdump: Build only on supported archs")
    [ Make it build only if NO_LIBELF isn't defined, as jitdump.o will only be built in that case ]
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Maciej Debski
     
  • commit cf346d5bd4b9d61656df2f72565c9b354ef3ca0d upstream.

    Both register_perl_scripting() and register_python_scripting() allocate
    this variable, fix it by checking if it already was.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Tom Zanussi
    Cc: Wang Nan
    Fixes: 7e4b21b84c43 ("perf/scripts: Add Python scripting engine")
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Arnaldo Carvalho de Melo
     
  • commit c56cb33b56c13493eeb95612f80e4dd6e35cd109 upstream.

    Since 841e3558b2d ("perf callchain: Recording 'dwarf' callchains do not
    need DWARF unwinding support"), --call-graph dwarf is allowed in 'perf
    record' even without unwind support. A couple of other places don't
    reflect this yet though: the help text should list dwarf as a valid
    record mode and the dump_size config should be respected too.

    Signed-off-by: Rabin Vincent
    Cc: He Kuang
    Fixes: 841e3558b2de ("perf callchain: Recording 'dwarf' callchains do not need DWARF unwinding support")
    Link: http://lkml.kernel.org/r/1470837148-7642-1-git-send-email-rabin.vincent@axis.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Rabin Vincent
     
  • commit ed6c166cc7dc329736cace3affd2df984fb22ec8 upstream.

    Fixes a perf diff regression issue which was introduced by commit
    5baecbcd9c9a ("perf symbols: we can now read separate debug-info files
    based on a build ID")

    The binary name could be same when perf diff different binaries. Build
    id is used to distinguish between them.
    However, the previous patch assumes the same binary name has same build
    id. So it overwrites the build id according to the binary name,
    regardless of whether the build id is set or not.

    Check the has_build_id in dso__load. If the build id is already set, use
    it.

    Before the fix:

    $ perf diff 1.perf.data 2.perf.data
    # Event 'cycles'
    #
    # Baseline Delta Shared Object Symbol
    # ........ ....... ................ .............................
    #
    99.83% -99.80% tchain_edit [.] f2
    0.12% +99.81% tchain_edit [.] f3
    0.02% -0.01% [ixgbe] [k] ixgbe_read_reg

    After the fix:
    $ perf diff 1.perf.data 2.perf.data
    # Event 'cycles'
    #
    # Baseline Delta Shared Object Symbol
    # ........ ....... ................ .............................
    #
    99.83% +0.10% tchain_edit [.] f3
    0.12% -0.08% tchain_edit [.] f2

    Signed-off-by: Kan Liang
    Cc: Andi Kleen
    CC: Dima Kogan
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Fixes: 5baecbcd9c9a ("perf symbols: we can now read separate debug-info files based on a build ID")
    Link: http://lkml.kernel.org/r/1481642984-13593-1-git-send-email-kan.liang@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Kan Liang
     
  • commit 2bd42f3aaa53ebe78b9be6f898b7945dd61f9773 upstream.

    There might be systems where MAP_32BIT is not defined, like some some
    RHEL7 powerpc versions.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Kyle McMartin
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Fixes: 256763b01741 ("perf trace beauty mmap: Add more conditional defines")
    Link: http://lkml.kernel.org/r/1481831814-23683-1-git-send-email-jolsa@kernel.org
    [ Changed the Fixme cset to the one removing the conditional switch case for MAP_32BIT ]
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • commit 631ac41b46d293fb3ee43a809776c1663de8d9c6 upstream.

    Removing extra '--' prefix.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Fixes: ad16511b0e40 ("perf mem: Add -U/-K (--all-user/--all-kernel) options")
    Link: http://lkml.kernel.org/r/1481538943-21874-2-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • commit ecf1e2253ea79c6204f4d6a5e756e8fb4aed5a7e upstream.

    Instead of the one when another syscall takes place while another is being
    processed (in another CPU, but we show it serialized, so need to "interrupt"
    the other), and also when finally showing the sys_enter + sys_exit + duration,
    where we were showing the sample->time for the sys_exit, duh.

    Before:

    # perf trace sleep 1

    0.373 ( 0.001 ms): close(fd: 3 ) = 0
    1000.626 (1000.211 ms): nanosleep(rqtp: 0x7ffd6ddddfb0) = 0
    1000.653 ( 0.003 ms): close(fd: 1 ) = 0
    1000.657 ( 0.002 ms): close(fd: 2 ) = 0
    1000.667 ( 0.000 ms): exit_group( )
    #

    After:

    # perf trace sleep 1

    0.336 ( 0.001 ms): close(fd: 3 ) = 0
    0.373 (1000.086 ms): nanosleep(rqtp: 0x7ffe303e9550) = 0
    1000.481 ( 0.002 ms): close(fd: 1 ) = 0
    1000.485 ( 0.001 ms): close(fd: 2 ) = 0
    1000.494 ( 0.000 ms): exit_group( )
    [root@jouet linux]#

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-ecbzgmu2ni6glc6zkw8p1zmx@git.kernel.org
    Fixes: 752fde44fd1c ("perf trace: Support interrupted syscalls")
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Arnaldo Carvalho de Melo
     

09 Jan, 2017

1 commit

  • commit edee44be59190bf22d5c6e521f3852b7ff16862f upstream.

    'perf report --tui' exits with error when it finds a sample of zero
    length symbol (i.e. addr == sym->start == sym->end). Actually these are
    valid samples. Don't exit TUI and show report with such symbols.

    Reported-and-Tested-by: Anton Blanchard
    Link: https://lkml.org/lkml/2016/10/8/189
    Signed-off-by: Ravi Bangoria
    Cc: Alexander Shishkin
    Cc: Benjamin Herrenschmidt
    Cc: Chris Riyder
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: Masami Hiramatsu
    Cc: Michael Ellerman
    Cc: Nicholas Piggin
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1479804050-5028-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Ravi Bangoria
     

09 Nov, 2016

5 commits

  • Markus reported that there's a weird behavior on perf top --hierarchy
    regarding the column length.

    Looking at the code, I found a dubious code which affects the symptoms.
    When --hierarchy option is used, the last column length might be
    inaccurate since it skips to update the length on leaf entries.

    I cannot remember why it did and looks like a leftover from previous
    version during the development.

    Anyway, updating the column length often is not harmful. So let's move
    the code out.

    Reported-and-Tested-by: Markus Trippelsdorf
    Signed-off-by: Namhyung Kim
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Fixes: 1a3906a7e6b9 ("perf hists: Resort hist entries with hierarchy")
    Link: http://lkml.kernel.org/r/20161108130833.9263-5-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • When horizontall scrolling is used in hierarchy mode, the the right most
    column has unnecessary indentation. Actually it's needed only if some
    of left (overhead) columns were shown.

    Signed-off-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Tested-by: Markus Trippelsdorf
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20161108130833.9263-4-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • When horizontal scrolling is used in hierarchy mode, the folded signed
    disappears at the right most column.

    Committer note:

    To test it, run 'perf top --hierarchy, see the '+' symbol at the first
    column, then press the right arrow key, the '+' symbol will disappear,
    this patch fixes that.

    Signed-off-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Tested-by: Markus Trippelsdorf
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20161108130833.9263-3-namhyung@kernel.org
    [ Move 'width -= 2' invariant to right after the if/else ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • It should indent 2 spaces for folded sign and a whitespace.

    Signed-off-by: Namhyung Kim
    Tested-by: Markus Trippelsdorf
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20161108130833.9263-2-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • The perf report/top on TUI supports horizontal scrolling using LEFT and
    RIGHT keys.

    But it calculate the number of columns incorrectly when hierarchy mode
    is enabled so that keep pressing RIGHT key can make the output
    disappeared.

    In the hierarchy mode, all sort keys are collapsed into a single column,
    so it needs to be applied when calculating column numbers.

    Reported-and-Tested-by: Markus Trippelsdorf
    Signed-off-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20161024162110.17918-1-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

17 Oct, 2016

2 commits

  • When building on Ubuntu 16.04, I get the following error:

    Makefile:49: *** the openjdk development package appears to me missing, install and try again. Stop.

    The problem is that update-java-alternatives has multiple spaces between
    fields, and cut treats each space as a new delimiter:

    java-1.8.0-openjdk-ppc64el 1081 /usr/lib/jvm/java-1.8.0-openjdk-ppc64el

    Fix this by using awk, which handles this fine.

    Signed-off-by: Anton Blanchard
    Reviewed-by: Stephane Eranian
    Cc: Alexander Shishkin
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1476325243-15788-1-git-send-email-anton@ozlabs.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Anton Blanchard
     
  • This patch helps with Sukadev's vendor event tree where such events can happen.

    >From Andi Kleen:
    Any event including a .c/.o/.bpf currently triggers BPF compilation or loading
    and then an error. This can happen for some Intel vendor events, which cannot
    be used.

    This patch fixes this problem by forbidding BPF file patch containing '{', '}'
    and ',', make sure flex consumes the leading '{', instead of matching it using
    a BPF file path.

    Tested result:

    $ perf stat -e '{unc_p_clockticks,unc_p_power_state_occupancy.cores_c0}' -a -I 1000
    invalid or unsupported event: '{unc_p_clockticks,unc_p_power_state_occupancy.cores_c0}'
    Run 'perf list' for a list of valid events
    (as expected, interperted as event)

    $ perf stat -e 'aaa.c' -a -I 1000
    ERROR: problems with path aaa.c: No such file or directory
    (as expected, interpreted as BPF source)

    $ perf stat -e 'aaa.ccc' -a -I 1000
    invalid or unsupported event: 'aaa.ccc'
    (as expected, interpreted as event)

    $ perf stat -e '{aaa.c}' -a -I 1000
    ERROR: problems with path aaa.c: No such file or directory
    event syntax error: '{aaa.c}'

    (as expected, interpreted as BPF source)

    $ perf stat -e '{cycles,aaa.c}' -a -I 1000
    ERROR: problems with path aaa.c: No such file or directory
    event syntax error: '{cycles,aaa.c}'
    (as expected, interpreted as BPF source)

    Signed-off-by: Wang Nan
    Tested-by: Arnaldo Carvalho de Melo
    Reported-by: Andi Kleen
    Cc: Jiri Olsa
    Cc: Sukadev Bhattiprolu
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1475900185-37967-1-git-send-email-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     

13 Oct, 2016

2 commits

  • Sukadev reported segfault on releasing perf env's numa data. It's due
    to nr_numa_nodes being set no matter if the numa data gets parsed
    properly. The perf_env__exit crash the on releasing non existed data.

    Setting nr_numa_nodes only when data are parsed out properly.

    Signed-off-by: Jiri Olsa
    Reported-by: Sukadev Bhattiprolu
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-dt9c0zgkt4hybn2cr4xiawta@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Markus reported that 'perf top --hierarchy' cannot scroll down after
    refresh. This was because the number of entries are not updated when
    hierarchy is enabled.

    Unlike normal report view, hierarchy mode needs to keep its own entry
    count since it can have non-leaf entries which can expand/collapse.

    Reported-and-Tested-by: Markus Trippelsdorf
    Signed-off-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Fixes: f5b763feebe9 ("perf hists browser: Count number of hierarchy entries")
    Link: http://lkml.kernel.org/r/20161007050412.3000-1-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

06 Oct, 2016

4 commits

  • Add two tips that describe --list option of config sub-command and
    explain how to choose particular config file location.

    Signed-off-by: Nambong Ha
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Taeung Song
    Link: http://lkml.kernel.org/r/1475191562-3240-1-git-send-email-over3025@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Nambong Ha
     
  • Signed-off-by: Donghyun Kim
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Taeung Song
    Link: http://lkml.kernel.org/r/1475187357-21882-1-git-send-email-dongdong9335@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Donghyun Kim
     
  • There is a existing tip as below.

    If you have debuginfo enabled, try: perf report -s sym,srcline

    However this tip only describe a condition to use --sort sym,scrline
    options. So there is lack of explanation in the tip. I think that it
    would be better to add a tip that exactly explains the feature of --sort
    srcline.

    Signed-off-by: Seonyoung Kim
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Taeung Song
    Link: http://lkml.kernel.org/r/1475194602-5596-1-git-send-email-adamas0414@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Kim SeonYoung
     
  • Intel fixed counters are special cases in the JSON conversion process
    because their decoding differs between perf and the event files. Add
    some missing entries in the conversion table.

    Signed-off-by: Andi Kleen
    Cc: Jiri Olsa
    Cc: Sukadev Bhattiprolu
    Link: http://lkml.kernel.org/r/1475696832-9188-4-git-send-email-andi@firstfloor.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     

05 Oct, 2016

3 commits

  • The MTC packet provides a 8-bit slice of CTC which is related to TSC by
    the TMA packet, however the TMA packet only provides the lower 16 bits
    of CTC. If mtc_shift > 8 then some of the MTC bits are not in the CTC
    provided by the TMA packet. Fix-up the last_mtc calculated from the TMA
    packet by copying the missing bits from the current MTC assuming the
    least difference between the two, and that the current MTC comes after
    last_mtc.

    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Cc: stable@vger.kernel.org # v4.3+
    Link: http://lkml.kernel.org/r/1475062896-22274-2-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • In cycle-accurate mode, timestamps can be calculated from CYC packets.
    The decoder also estimates timestamps based on the number of
    instructions since the last timestamp. For that to work in
    cycle-accurate mode, the instruction count needs to be reset to zero
    when a timestamp is calculated from a CYC packet, but that wasn't
    happening, so fix it.

    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Cc: stable@vger.kernel.org # v4.3+
    Link: http://lkml.kernel.org/r/1475062896-22274-1-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Perf uretprobe probes on GEP(Global Entry Point) which fails to record
    all function calls via LEP(Local Entry Point). Fix that by probing on LEP.

    Objdump:

    00000000100005f0 :
    100005f0: 02 10 40 3c lis r2,4098
    100005f4: 00 7f 42 38 addi r2,r2,32512
    100005f8: a6 02 08 7c mflr r0
    100005fc: 10 00 01 f8 std r0,16(r1)
    10000600: f8 ff e1 fb std r31,-8(r1)

    Before applying patch:

    $ cat /sys/kernel/debug/tracing/uprobe_events
    r:probe_uprobe_test/doit /home/ravi/uprobe_test:0x00000000000005f0

    After applying patch:

    $ cat /sys/kernel/debug/tracing/uprobe_events
    r:probe_uprobe_test/doit /home/ravi/uprobe_test:0x00000000000005f8

    This is not the case with kretprobes because the kernel itself finds LEP
    and probes on it.

    Signed-off-by: Ravi Bangoria
    Cc: Alexander Shishkin
    Cc: Balbir Singh
    Cc: Masami Hiramatsu
    Cc: Naveen N. Rao
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1475576865-6562-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ravi Bangoria
     

04 Oct, 2016

14 commits

  • Add support for the "frontend" extra MSR on Skylake in the JSON
    conversion.

    Signed-off-by: Andi Kleen
    Acked-by: Ingo Molnar
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-19-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • The JSON event lists use a different encoding for fixed counters than
    perf for instructions and cycles (ref-cycles is ok)

    This lead to some common events like inst_retired.any or
    cpu_clk_unhalted.thread not counting, when specified with their JSON
    name.

    Special case these events in the jevents conversion process. I prefer
    to not touch the JSON files for this, as it's intended that standard
    JSON files can be just dropped into the perf build without changes.

    Signed-off-by: Andi Kleen
    Signed-off-by: Sukadev Bhattiprolu
    [Fix minor compile error]
    Acked-by: Ingo Molnar
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-18-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • Make alias matching the events parser case-insensitive. This is useful
    with the JSON events. perf uses lower case events, but the CPU manuals
    generally use upper case event names. The JSON files use lower case by
    default too. But if we search case insensitively then users can
    cut-n-paste the upper case event names.

    So the following works:

    % perf stat -e BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL true

    Performance counter stats for 'true':

    305 BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL

    0.000492799 seconds time elapsed

    Signed-off-by: Andi Kleen
    Acked-by: Ingo Molnar
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-17-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • This avoids the JSON PMU events parser having to know whether its
    aliases are for perf stat or perf record.

    Signed-off-by: Andi Kleen
    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Ingo Molnar
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-20-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Sukadev Bhattiprolu
     
  • Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Ingo Molnar
    Acked-by: Jiri Olsa
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-16-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Sukadev Bhattiprolu
     
  • Add support to group the output of perf list by the Topic field in the
    JSON file.

    Example output:

    % perf list
    ...
    Cache:
    l1d.replacement
    [L1D data line replacements]
    l1d_pend_miss.pending
    [L1D miss oustandings duration in cycles]
    l1d_pend_miss.pending_cycles
    [Cycles with L1D load Misses outstanding]
    l2_l1d_wb_rqsts.all
    [Not rejected writebacks from L1D to L2 cache lines in any state]
    l2_l1d_wb_rqsts.hit_e
    [Not rejected writebacks from L1D to L2 cache lines in E state]
    l2_l1d_wb_rqsts.hit_m
    [Not rejected writebacks from L1D to L2 cache lines in M state]

    ...
    Pipeline:
    arith.fpu_div
    [Divide operations executed]
    arith.fpu_div_active
    [Cycles when divider is busy executing divide operations]
    baclears.any
    [Counts the total number when the front end is resteered, mainly
    when the BPU cannot provide a correct prediction and this is
    corrected by other branch handling mechanisms at the front end]
    br_inst_exec.all_branches
    [Speculative and retired branches]
    br_inst_exec.all_conditional
    [Speculative and retired macro-conditional branches]
    br_inst_exec.all_direct_jmp
    [Speculative and retired macro-unconditional branches excluding
    calls and indirects]
    br_inst_exec.all_direct_near_call
    [Speculative and retired direct near calls]
    br_inst_exec.all_indirect_jump_non_call_ret

    Signed-off-by: Andi Kleen
    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Ingo Molnar
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-14-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • Previously we were dropping the useful longer descriptions that some
    events have in the event list completely. This patch makes them appear with
    perf list.

    Old perf list:

    baclears:
    baclears.all
    [Counts the number of baclears]

    vs new:

    perf list -v:
    ...
    baclears:
    baclears.all
    [The BACLEARS event counts the number of times the front end is
    resteered, mainly when the Branch Prediction Unit cannot provide
    a correct prediction and this is corrected by the Branch Address
    Calculator at the front end. The BACLEARS.ANY event counts the
    number of baclears for any type of branch]

    Signed-off-by: Andi Kleen
    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Ingo Molnar
    Acked-by: Jiri Olsa
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-13-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Sukadev Bhattiprolu
     
  • Implement support in jevents to parse long descriptions for events that
    may have them in the JSON files. A follow on patch will make this long
    description available to user through the 'perf list' command.

    Signed-off-by: Andi Kleen
    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Ingo Molnar
    Acked-by: Jiri Olsa
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-11-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Sukadev Bhattiprolu
     
  • Add a PERF_CPUID variable to override the CPUID of the current CPU
    (within the current architecture). This is useful for testing, so that
    all event lists can be tested on a single system.

    Signed-off-by: Andi Kleen
    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Ingo Molnar
    Acked-by: Jiri Olsa
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-10-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • Add a --no-desc flag to 'perf list' to not print the event descriptions
    that were earlier added for JSON events. This may be useful to get a
    less crowded listing.

    It's still default to print descriptions as that is the more useful
    default for most users.

    Signed-off-by: Andi Kleen
    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Ingo Molnar
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1473978296-20712-9-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • Automatically adapt the now wider and word wrapped perf list output to
    wider terminals. This requires querying the terminal before the auto
    pager takes over, and exporting this information from the pager
    subsystem.

    Signed-off-by: Andi Kleen
    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Ingo Molnar
    Acked-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-8-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • Add support to print alias descriptions in perf list, which are taken
    from the generated event files.

    The sorting code is changed to put the events with descriptions at the
    end. The descriptions are printed as possibly multiple word wrapped
    lines.

    Example output:

    % perf list
    ...
    arith.fpu_div
    [Divide operations executed]
    arith.fpu_div_active
    [Cycles when divider is busy executing divide operations]

    Committer notes:

    Further testing on a Broadwell machine (ThinkPad t450s), using these
    files:

    $ find tools/perf/pmu-events/arch/x86/
    tools/perf/pmu-events/arch/x86/
    tools/perf/pmu-events/arch/x86/Broadwell
    tools/perf/pmu-events/arch/x86/Broadwell/Cache.json
    tools/perf/pmu-events/arch/x86/Broadwell/Other.json
    tools/perf/pmu-events/arch/x86/Broadwell/Frontend.json
    tools/perf/pmu-events/arch/x86/Broadwell/Virtual-Memory.json
    tools/perf/pmu-events/arch/x86/Broadwell/Pipeline.json
    tools/perf/pmu-events/arch/x86/Broadwell/Floating-point.json
    tools/perf/pmu-events/arch/x86/Broadwell/Memory.json
    tools/perf/pmu-events/arch/x86/mapfile.csv
    $

    Taken from:

    https://github.com/sukadev/linux/tree/json-code+data-v21/tools/perf/pmu-events/arch/x86/

    to get this machinery to actually parse JSON files, generate
    $(OUTPUT)pmu-events/pmu-events.c, compile it and link it with perf, that
    will then use the table it contains, these files will be submitted right
    after this patchkit.

    [acme@jouet linux]$ perf list page_walker

    List of pre-defined events (to be used in -e):

    page_walker_loads.dtlb_l1
    [Number of DTLB page walker hits in the L1+FB]
    page_walker_loads.dtlb_l2
    [Number of DTLB page walker hits in the L2]
    page_walker_loads.dtlb_l3
    [Number of DTLB page walker hits in the L3 + XSNP]
    page_walker_loads.dtlb_memory
    [Number of DTLB page walker hits in Memory]
    page_walker_loads.itlb_l1
    [Number of ITLB page walker hits in the L1+FB]
    page_walker_loads.itlb_l2
    [Number of ITLB page walker hits in the L2]
    page_walker_loads.itlb_l3
    [Number of ITLB page walker hits in the L3 + XSNP]

    [acme@jouet linux]$

    Signed-off-by: Andi Kleen
    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Ingo Molnar
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-7-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • To work with existing mapfiles, assume that the first line in
    'mapfile.csv' is a header line and skip over it.

    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Ingo Molnar
    Acked-by: Jiri Olsa
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1473978296-20712-15-git-send-email-sukadev@linux.vnet.ibm.com
    Cc: linuxppc-dev@lists.ozlabs.org
    Signed-off-by: Andi Kleen
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • Implement the code to match CPU types to mapfile types for x86 based on
    CPUID. This extends an existing similar function, but changes it to use
    the x86 mapfile cpu description. This allows to resolve event lists
    generated by jevents.

    Signed-off-by: Andi Kleen
    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Ingo Molnar
    Acked-by: Jiri Olsa
    Cc: Madhavan Srinivasan
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-6-git-send-email-sukadev@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen