14 Nov, 2016

2 commits

  • Adding support to detect jvmti support. It is not plugged into the
    FEATURE_TESTS machinery, because it's quite rare and will be used
    separately from perf via feature_check call.

    Signed-off-by: Jiri Olsa
    Tested-by: Stephane Eranian
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: William Cohen
    Link: http://lkml.kernel.org/r/1478093749-5602-3-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Adding support to remove options from final CFLAGS for both object file
    and build target. It's now possible to remove CFLAGS options like:

    CFLAGS_REMOVE_krava.o += -Wstrict-prototypes

    Committer notes:

    This comes from the kernel's kbuild infrastructure, the subset that is
    supported in tools/ is being documented at tools/build/Documentation/Build.txt.

    Signed-off-by: Jiri Olsa
    Tested-by: Stephane Eranian
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: William Cohen
    Link: http://lkml.kernel.org/r/1478093749-5602-2-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

12 Nov, 2016

1 commit

  • Since the unprivileged sched switch event was added in perf, PT doesn't
    need need perf_event_paranoid=-1 anymore for per cpu decoding.

    Add a note stating that that is only needed for kernels < 4.2.

    Reported-by: Andi Kleen
    Report-Link: http://lkml.kernel.org/r/http://lkml.kernel.org/n/tip-x2ybghpqxxn3zu0m8o7qi42r@git.kernel.org
    Acked-by: Adrian Hunter
    Fixes: 45ac1403f564 ("perf: Add PERF_RECORD_SWITCH to indicate context switches")
    Link: http://lkml.kernel.org/n/tip-x2ybghpqxxn3zu0m8o7qi42r@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

08 Nov, 2016

1 commit

  • 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

    Rabin Vincent
     

29 Oct, 2016

1 commit

  • …ernel/git/acme/linux into perf/core

    perf/core improvements and fixes from Arnaldo Carvalho de Melo:

    New features:

    - Support matching by topic in 'perf list' (Andi Kleen)

    User visible:

    - Apply cpu color only when there was activity in 'perf sched map' (Namhyung Kim)

    - Always show the task's COMM in 'perf sched map -v' (Namhyung Kim)

    - Fix hierarchy column counts in the perf hist browser (top, report), avoiding
    showing nothing after pressing the RIGHT key a number of times (Namhyung Kim)

    Infrastructure:

    - Support cascading options in libsubcmd and use it to share common options in
    'perf sched' subcommands (Namhyung Kim)

    - Avoid worker cacheline bouncing in 'perf bench futex' (Davidlohr Bueso)

    - Sanitize numeric parameters in 'perf bench futex' (Davidlohr Bueso)

    - Update copies of kernel files (Arnaldo Carvalho de Melo)

    - Fix scripting (perl, python) setup to avoid leaks (Arnaldo Carvalho de Melo)

    - Add missing object file to the python binding linkage list (Arnaldo Carvalho de Melo)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

28 Oct, 2016

8 commits

  • In ac12f6764c50 ("perf tools: Implement branch_type event parameter") we
    started using the parse_branch_str() function from one of the files used
    in the python binding, which caused this entry in 'perf test' to fail:

    # perf test -v python
    16: Try 'import perf' in python, checking link problems :
    --- start ---
    test child forked, pid 16667
    Traceback (most recent call last):
    File "", line 1, in
    ImportError: /tmp/build/perf/python/perf.so: undefined symbol:
    parse_branch_str
    test child finished with -1
    ---- end ----
    Try 'import perf' in python, checking link problems: FAILED!
    #

    I must've commited some mistake when running 'perf test' to send the
    pull request for the perf-core-for-mingo-20161024 tag, to have let this
    regression to pass, sigh.

    Just add tools/perf/util/parse-branch-options.c and switch from using
    ui__warning(), that is not available in the python binding, use
    pr_warning() instead, which is good enough for this case.

    Now:

    # perf test python
    16: Try 'import perf' in python, checking link problems : Ok
    #

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Cc: Andi Kleen
    Fixes: ac12f6764c50 ("perf tools: Implement branch_type event parameter")
    Link: http://lkml.kernel.org/n/tip-9kn1ct1cx9ppwqlmzl6z0xhs@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Removing one more set of die() calls.

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

    Arnaldo Carvalho de Melo
     
  • 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

    Arnaldo Carvalho de Melo
     
  • Introduced in commit f9afc6197e9b ("x86: Wire up protection keys system
    calls")

    This will make 'perf trace' aware of them on x86_64.

    Cc: Adrian Hunter
    Cc: Dave Hansen
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Thomas Gleixner
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-s1ta2ttv2xacecqogmd3a9p1@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To get the defines introduced in the commit e8c24d3a23a4 ("x86/pkeys:
    Allocation/free syscalls")

    Silencing this perf build warning:

    Warning: tools/include/uapi/asm-generic/mman-common.h differs from kernel

    Need to change 'perf trace' to beautify those syscalls, as soon as
    booting with a kernel with it.

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

    Arnaldo Carvalho de Melo
     
  • Ignore export.h and EXPORT_SYMBOL in:

    784d5699eddc ("x86: move exports to actual definitions")

    We're not dragging this stuff, not useful in tools/

    This silences the following warnings while building perf:

    Warning: tools/arch/x86/lib/memcpy_64.S differs from kernel
    Warning: tools/arch/x86/lib/memset_64.S differs from kernel

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

    Arnaldo Carvalho de Melo
     
  • Add support in perf list topic to only show events belonging to a
    specific vendor events topic. For example the following works now:

    % perf list frontend
    List of pre-defined events (to be used in -e):

    stalled-cycles-frontend OR idle-cycles-frontend [Hardware event]

    stalled-cycles-frontend OR cpu/stalled-cycles-frontend/ [Kernel PMU event]

    frontend:
    dsb2mite_switches.count
    [Decode Stream Buffer (DSB)-to-MITE switches]
    dsb2mite_switches.penalty_cycles
    [Decode Stream Buffer (DSB)-to-MITE switch true penalty cycles]
    dsb_fill.exceed_dsb_lines
    [Cycles when Decode Stream Buffer (DSB) fill encounter more than 3 Decode Stream Buffer (DSB)
    lines]
    icache.hit
    [Number of Instruction Cache, Streaming Buffer and Victim Cache Reads. both cacheable and
    noncacheable, including UC fetches]
    ...

    Signed-off-by: Andi Kleen
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1476902724-9586-2-git-send-email-andi@firstfloor.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • Joonwoo reported that there's a mismatch between timestamps in script
    and sched commands. This was because of difference in printing the
    timestamp. Factor out the code and share it so that they can be in
    sync. Also I found that sched map has similar problem, fix it too.

    Committer notes:

    Fixed the max_lat_at bug introduced by Namhyung's original patch, as
    pointed out by Joonwoo, and made it a function following the scnprintf()
    model, i.e. returning the number of bytes formatted, and receiving as
    the first parameter the object from where the data to the formatting is
    obtained, renaming it from:

    char *timestamp_in_usec(char *bf, size_t size, u64 timestamp)

    to

    int timestamp__scnprintf_usec(u64 timestamp, char *bf, size_t size)

    Reported-by: Joonwoo Park
    Signed-off-by: Namhyung Kim
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20161024020246.14928-3-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

26 Oct, 2016

2 commits

  • I'd like to see the name of tasks with perf sched map, but it only shows
    name of new tasks and then use short names after all. This is not good
    for long running tasks since it's hard for users to track the short
    names. This patch makes it show the names (except the idle task) when
    -v option is used. Probably we may make it as default behavior.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20161024020246.14928-2-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Applying cpu color always doesn't help readability IMHO. Instead it
    might be better to applying the color when there's an activity on those
    CPUs.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20161024020246.14928-1-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

25 Oct, 2016

6 commits

  • The -i and -v options can be used in subcommands so enable cascading the
    sched_options. This fixes the following inconvenience in 'perf sched':

    $ perf sched -i perf.data.sched map
    ... (it works well) ...

    $ perf sched map -i perf.data.sched
    Error: unknown switch `i'

    Usage: perf sched map []

    --color-cpus
    highlight given CPUs in map
    --color-pids
    highlight given pids in map
    --compact map output in compact mode
    --cpus display given CPUs in map

    With this patch, the second command line works with the perf.data.sched
    data file.

    Signed-off-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Acked-by: Jiri Olsa
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Josh Poimboeuf
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20161024030003.28534-2-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Sometimes subcommand have common options and it can only handled in the
    upper level command unless it duplicates the options.

    This patch adds a parent field and fallback to the parent if the given
    argument was not found in the current options.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Josh Poimboeuf
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20161024030003.28534-1-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
     
  • This gets rid of oddities such as:

    perf bench futex hash -t -4
    perf: calloc: Cannot allocate memory

    Runtime (and many more) are equally busted, i.e. run for bogus amounts of
    time. Just use the abs, instead of, for example errorring out.

    Committer note:

    After the patch:

    $ perf bench futex hash -t -4
    # Running 'futex/hash' benchmark:
    Run summary [PID 10178]: 4 threads, each operating on 1024 [private] futexes for 10 secs.

    [thread 0] futexes: 0x34f9fa0 ... 0x34faf9c [ 4702208 ops/sec ]
    [thread 1] futexes: 0x34fb140 ... 0x34fc13c [ 4707020 ops/sec ]
    [thread 2] futexes: 0x34fc2e0 ... 0x34fd2dc [ 4711526 ops/sec ]
    [thread 3] futexes: 0x34fd480 ... 0x34fe47c [ 4709683 ops/sec ]

    Averaged 4707609 operations/sec (+- 0.04%), total secs = 10
    $

    Signed-off-by: Davidlohr Bueso
    Tested-by: Arnaldo Carvalho de Melo
    Link: http://lkml.kernel.org/r/1477342613-9938-3-git-send-email-dave@stgolabs.net
    Signed-off-by: Arnaldo Carvalho de Melo

    Davidlohr Bueso
     
  • Sebastian noted that overhead for worker thread ops (throughput)
    accounting was producing 'perf' to appear in the profiles, consuming a
    non-trivial (i.e. 13%) amount of CPU.

    This is due to cacheline bouncing due to the increment of w->ops.

    We can easily fix this by just working on a local copy and updating the
    actual worker once done running, and ready to show the program summary.
    There is no danger of the worker being concurrent, so we can trust that
    no stale value is being seen by another thread.

    This also gets rid of the unnecessary cache alignment hack; its not
    worth it.

    Reported-by: Sebastian Andrzej Siewior
    Signed-off-by: Davidlohr Bueso
    Acked-by: Sebastian Andrzej Siewior
    Link: http://lkml.kernel.org/r/1477342613-9938-2-git-send-email-dave@stgolabs.net
    Signed-off-by: Arnaldo Carvalho de Melo

    Davidlohr Bueso
     
  • …ernel/git/acme/linux into perf/core

    Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

    New features:

    - Dynamicly change verbosity level by pressing 'V' in the 'perf top/report'
    hists TUI browser (Alexis Berlemont)

    - Implement 'perf trace --delay' in the same fashion as in 'perf record --delay',
    to skip sampling workload initialization events (Alexis Berlemont)

    - Make vendor named events case insensitive in 'perf list', i.e.
    'perf list LONGEST_LAT' works just the same as 'perf list longest_lat' (Andi Kleen)

    - Show instruction bytes and lenght in 'perf script' for Intel PT and BTS (Andi Kleen, Adrian Hunter)

    E.g:

    % perf record -e intel_pt// foo
    % perf script --itrace=i0ns -F ip,insn,insnlen
    ffffffff8101232f ilen: 5 insn: 0f 1f 44 00 00
    ffffffff81012334 ilen: 1 insn: 5b
    ffffffff81012335 ilen: 1 insn: 5d
    ffffffff81012336 ilen: 1 insn: c3
    ffffffff810123e3 ilen: 1 insn: 5b
    ffffffff810123e4 ilen: 2 insn: 41 5c
    ffffffff810123e6 ilen: 1 insn: 5d
    ffffffff810123e7 ilen: 1 insn: c3
    ffffffff810124a6 ilen: 2 insn: 31 c0
    ffffffff810124a8 ilen: 9 insn: 41 83 bc 24 a8 01 00 00 01
    ffffffff810124b1 ilen: 2 insn: 75 87

    - Allow enabling the perf_event_attr.branch_type attribute member: (Andi Kleen)

    perf record -e sched:sched_switch,cpu/cpu-cycles,branch_type=any/ ...

    - Add unwinding support for jitdump (Stefano Sanfilippo)

    Fixes:

    - Use raw_syscall:sys_enter timestamp in 'perf trace' (Arnaldo Carvalho de Melo)

    Infrastructure:

    - Allow jitdump to be built without libdwarf (Maciej Debski)

    - Sync x86's syscall table tools/ copy (Arnaldo Carvalho de Melo)

    - Fixes to avoid calling die() in library fuctions already propagating other
    errors (Arnaldo Carvalho de Melo)

    - Improvements to allow libtraceevent to be properly installed in distro
    packages (Jiri Olsa)

    - Removing coresight miscellaneous debug output (Mathieu Poirier)

    - Cache align the 'perf bench futex' worker struct (Sebastian Andrzej Siewior)

    Documentation:

    - Minor improvements on the documentation of event parameters (Andi Kleen)

    - Add jitdump format specification document (Stephane Eranian)

    Spelling fixes:

    - Fix typo "No enough" to "Not enough" (Alexander Alemayhu)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

24 Oct, 2016

19 commits

  • Printing the full path of the selected link is obviously not needed,
    hence removing.

    Signed-off-by: Mathieu Poirier
    Cc: Peter Zijlstra
    Cc: linux-arm-kernel@lists.infradead.org
    Link: http://lkml.kernel.org/r/1476913323-6836-1-git-send-email-mathieu.poirier@linaro.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Mathieu Poirier
     
  • Make the 'perf list' glob matching for vendor events case insensitive.
    This allows to use the upper case vendor events with perf list too.

    Now the following works:

    % perf list LONGEST_LAT

    ...

    cache:
    longest_lat_cache.miss
    [Core-originated cacheable demand requests missed LLC]
    longest_lat_cache.reference
    [Core-originated cacheable demand requests that refer to LLC]

    Signed-off-by: Andi Kleen
    Suggested-by: Ingo Molnar
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1476899402-31460-1-git-send-email-andi@firstfloor.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • 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

    Arnaldo Carvalho de Melo
     
  • Not used at all, we need just the entry_time to calculate the syscall
    duration.

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

    Arnaldo Carvalho de Melo
     
  • It popped up in perf testing that the worker consumes some amount of
    CPU. It boils down to the increment of `ops` which causes cache line
    bouncing between the individual threads.

    This patch aligns the struct by 256 bytes to ensure that not a cache
    line is shared among CPUs. 128 byte is the x86 worst case and grep says
    that L1_CACHE_SHIFT is set to 8 on s390.

    Signed-off-by: Sebastian Andrzej Siewior
    Cc: Davidlohr Bueso
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20161016190803.3392-1-bigeasy@linutronix.de
    Signed-off-by: Arnaldo Carvalho de Melo

    Sebastian Andrzej Siewior
     
  • We already have handling for errors when processing PERF_RECORD_ events,
    so instead of calling die() when not being able to alloc, propagate the
    error, so that the normal UI exit sequence can take place, the user be
    warned and possibly the terminal be properly reset to a sane mode.

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

    Arnaldo Carvalho de Melo
     
  • It already returns whatever strbuf_(grow|addch)() returns in case of
    failure, so just return -ENOSPC in the only case where it was die()ing.
    When it returns, its only caller will call die() anyway, so no need to
    be so eager, die later.

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

    Arnaldo Carvalho de Melo
     
  • Instead of having all tests perform alloc/free, do it in the code that
    calls the do_cycles() and do_gettimeofday() functions.

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

    Arnaldo Carvalho de Melo
     
  • In the perf wiki todo-list[1], there is an entry regarding initial-delay
    and 'perf trace'; the following small patch tries to fulfill this point.
    It has been generated against the branch tip/perf/core.

    It has only been implemented in the "trace__run" case.

    Ex.:

    $ sudo strace -- ./perf trace --delay 5 sleep 1 2>&1
    ...
    fcntl(7, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
    ioctl(7, PERF_EVENT_IOC_ID, 0x7ffc8fd35718) = 0
    ioctl(11, PERF_EVENT_IOC_SET_OUTPUT, 0x7) = 0
    fcntl(11, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
    ioctl(11, PERF_EVENT_IOC_ID, 0x7ffc8fd35718) = 0
    write(6, "\0", 1) = 1
    close(6) = 0
    nanosleep({0, 5000000}, NULL) = 0 # DELAY OF 5 MS BEFORE ENABLING THE EVENTS
    ioctl(3, PERF_EVENT_IOC_ENABLE, 0) = 0
    ioctl(4, PERF_EVENT_IOC_ENABLE, 0) = 0
    ioctl(5, PERF_EVENT_IOC_ENABLE, 0) = 0
    ioctl(7, PERF_EVENT_IOC_ENABLE, 0) = 0
    ...

    [1]: https://perf.wiki.kernel.org/index.php/Todo

    Signed-off-by: Alexis Berlemont
    Suggested-and-Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20161010054328.4028-2-alexis.berlemont@gmail.com
    [ Add entry to the manpage, cut'n'pasted from stat's and record's ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Alexis Berlemont
     
  • Here is a small patch which tries to fulfill a point in the perf todo
    list:

    * Make pressing 'V' multiple times to go on cycling thru various
    verbosity levels in 'perf top', so that info that is present in
    'perf top -v' can be obtained without having to restart the tool
    (acme).

    After a small grep in the code, the max verbosity level seems 3; so,
    we cycle at 4; I did not dare define a MAX_VERBOSE_LEVEL constant.

    Signed-off-by: Alexis Berlemont
    Suggested-and-Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20161012214823.14324-2-alexis.berlemont@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Alexis Berlemont
     
  • The latter version occurs much more when running git grep.

    Signed-off-by: Alexander Alemayhu
    Cc: Alexander Shishkin
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20161013161811.4939-1-alexander@alemayhu.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Alexander Alemayhu
     
  • With uncore event aliases which are duplicated over multiple PMUs the
    "Using CPUID" message with -v could be printed many times. Only print
    it once.

    Signed-off-by: Andi Kleen
    Cc: Jiri Olsa
    Cc: Stephane Eranian
    Cc: Sukadev Bhattiprolu
    Link: http://lkml.kernel.org/r/1476393332-20732-3-git-send-email-andi@firstfloor.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • This patch adds a formal specification of the jitdump format. The goal
    is to help jit runtime developers implement the jitdump support without
    having to read the jvmti code.

    Signed-off-by: Stephane Eranian
    Cc: Anton Blanchard
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1476356383-30100-10-git-send-email-eranian@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Stephane Eranian
     
  • Check the version number when opening a jitdump file. Accept older
    versions, but not newer ones.

    Signed-off-by: Stefano Sanfilippo
    Signed-off-by: Ross McIlroy
    Reviewed-by: Stephane Eranian
    Cc: Anton Blanchard
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1476356383-30100-9-git-send-email-eranian@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Stefano Sanfilippo
     
  • When the jit_buf_desc contains unwinding information, it is emitted as
    eh_frame unwinding sections in the DSOs generated by perf inject.

    The unwinding information is required to unwind of JITed code which do
    not maintain the frame pointer register during function calls. It can
    be emitted by V8 / Chromium when the --perf_prof_unwinding_info is
    passed to V8.

    The eh_frame and eh_frame_hdr sections are emitted immediately after the
    .text.

    The .eh_frame is aligned at a 8-byte boundary, and .eh_frame_hdr at a
    4-byte one. Since size of the .eh_frame is required to be a multiple of
    the word size, which means there will never be additional padding
    between it and the .eh_frame_hdr on machines where the word size is 4 or
    8 bytes.

    However, additional padding might be inserted between .text and
    .eh_frame to reach the correct alignment, which will always be 8 bytes,
    also on 32bit machines. The reasoning behind this choice is that 4 extra
    bytes of padding worst case are not a large cost for the advantage of
    removing word-size dependent offset calculations when emitting the
    jitdump.

    Signed-off-by: Stefano Sanfilippo
    Signed-off-by: Ross McIlroy
    Reviewed-by: Stephane Eranian
    Cc: Anton Blanchard
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1476356383-30100-8-git-send-email-eranian@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Stefano Sanfilippo
     
  • This record is intended to provide unwinding information in the
    eh_frame format. This is required to unwind JITed code which
    does not maintain the frame pointer register during function calls.

    The eh_frame unwinding information can be emitted by V8 / Chromium
    when the --perf_prof_unwinding_info is passed.

    A record of type jr_code_unwinding_info comes before the jr_code_load
    it referred to and contains both the .eh_frame and .eh_frame_hdr.

    The fields in the header have the following meaning:

    * unwinding_size: size of the eh_frame and eh_frame_hdr, necessary
    for distinguishing the content from the padding.

    * eh_frame_hdr_size: as the name says.

    * mapped_size: size of the payload that was in memory at runtime.
    typically unwinding_size if the .eh_frame_hdr and .eh_frame were
    mapped, or 0 if they weren't. It should always be the former case,
    since the .eh_frame is guaranteed to be mapped in memory. However,
    certain JITs might want to inject an .eh_frame_hdr with an empty LUT
    to trigger fp-based unwinding fallback in libunwind. The only part
    of the .eh_frame_hdr that libunwind reads from remote memory is the
    LUT, and since there is none, mapping the unwinding info in memory
    is not necessary, and 0 in this field signifies that it wasn't.
    This practical hack allows to save bytes in code memory for those
    JIT compilers that might or might not maintain a valid frame pointer.

    The payload that follows is assumed to contain first the .eh_frame and
    then the .eh_header_hdr, with no padding between the two.

    Signed-off-by: Stefano Sanfilippo
    Signed-off-by: Ross McIlroy
    Reviewed-by: Stephane Eranian
    Cc: Anton Blanchard
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1476356383-30100-7-git-send-email-eranian@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Stefano Sanfilippo
     
  • When calculating .eh_frame_hdr base and LUT offsets do not always assume
    that pgoff is zero.

    The assumption is false for DSOs built from the jitdump by perf inject,
    because the ELF header did not exist in memory at sampling time.

    Signed-off-by: Stefano Sanfilippo
    Signed-off-by: Ross McIlroy
    Reviewed-by: Stephane Eranian
    Cc: Anton Blanchard
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1476356383-30100-6-git-send-email-eranian@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Stefano Sanfilippo
     
  • The behavior before this commit was to skip the remaining portion of the
    jitdump in case an unknown record was found, including those records
    that perf could handle.

    With this change, parsing a record with an unknown id will cause a
    warning to be emitted, the record will be skipped and parsing will
    resume from the next (valid) one.

    The patch aims at making perf more future proof, by extracting as much
    information as possible from jitdumps.

    Signed-off-by: Stefano Sanfilippo
    Signed-off-by: Ross McIlroy
    Reviewed-by: Stephane Eranian
    Cc: Anton Blanchard
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1476356383-30100-5-git-send-email-eranian@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Stefano Sanfilippo
     
  • This patch removes all the string padding generated in the jitdump file.
    They are not necessary and were adding unnecessary complexity. Modern
    processors can handle unaligned accesses quite well. The perf.data/
    jitdump file are always post-processed, no need to add extra complexity
    for no real gain.

    Signed-off-by: Stephane Eranian
    Cc: Anton Blanchard
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1476356383-30100-4-git-send-email-eranian@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Stephane Eranian