19 Aug, 2010

1 commit

  • Parts of the build process were generating files outside the specified
    O= directory, causing the build to fail on systems where the sources are
    in a read only file system.

    Fix it by using $(OUTPUT) on these locations.

    Also check that $(OUTPUT) actually exists, just like the top level
    kernel Makefile does. Otherwise the failure message emitted is
    completely misleading.

    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    LKML-Reference:
    Signed-off-by: Kusanagi Kouichi
    Signed-off-by: Arnaldo Carvalho de Melo

    Kusanagi Kouichi
     

17 Aug, 2010

1 commit

  • POSIX sh does not specify the brace expansion, so fix it by replacing the
    global $(shell ...) lines quite at the top creating the output directories with
    real rules.

    Cc: Ingo Molnar
    Cc: Kusanagi Kouichi
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    LKML-Reference:
    Signed-off-by: Bernd Petrovitsch
    Signed-off-by: Arnaldo Carvalho de Melo

    Bernd Petrovitsch
     

11 Aug, 2010

6 commits


07 Aug, 2010

1 commit


02 Jul, 2010

1 commit


18 Jun, 2010

1 commit

  • Fix a typo introduced by recent Makefile changes, in f9af3a4. Without it, Perl
    scripting support won't get compiled in.

    Cc: Frédéric Weisbecker
    Cc: Ingo Molnar
    Cc: Stephane Eranian
    LKML-Reference:
    Signed-off-by: Tom Zanussi
    Signed-off-by: Arnaldo Carvalho de Melo

    Tom Zanussi
     

10 Jun, 2010

1 commit

  • Moving the tests to a separate file, feature-tests.mak and using a try-cc
    function similar to the try-run in Kbuild.

    This also makes the output more quiet as we can stop using the INTERMEDIATE
    target to remove the .perf.dev.null file needed for some gcc versions where
    /dev/null can't be used as the output file name.

    As the tests get shorter by uninlining the source code used to test for
    features, we can more properly use identation.

    The feature tests itself can be made more clear and reused, like when trying to
    see what is needed to have bfd_demangle.

    We also get a bit closer to reusing scripts/Kbuild.include, reducing the
    distance from the kernel build system.

    Tests performed:

    [root@emilia perf]# make -j9 O=/tmp/perf
    PERF_VERSION = 0.0.2.PERF
    GEN /tmp/perf/common-cmds.h
    * new build flags or prefix
    GEN perf-archive
    CC /tmp/perf/builtin-annotate.o
    CC /tmp/perf/bench/sched-messaging.o
    CC /tmp/perf/builtin-diff.o

    CC /tmp/perf/scripts/python/Perf-Trace-Util/Context.o
    CC /tmp/perf/perf.o
    CC /tmp/perf/builtin-help.o
    AR /tmp/perf/libperf.a
    LINK /tmp/perf/perf
    [root@emilia perf]#

    If we uninstall, for instance newt-devel we get:

    [root@emilia perf]# rpm -e newt-devel
    [root@emilia perf]# make -j9 O=/tmp/perf
    Makefile:564: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
    * new build flags or prefix
    GEN perf-archive
    CC /tmp/perf/perf.o
    CC /tmp/perf/builtin-annotate.o

    AR /tmp/perf/libperf.a
    LINK /tmp/perf/perf
    [root@emilia perf]#

    And then binutils-devel:

    [root@emilia perf]# make -j9 O=/tmp/perf
    Makefile:564: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
    Makefile:632: No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling
    * new build flags or prefix
    GEN perf-archive
    CC /tmp/perf/perf.o

    AR /tmp/perf/libperf.a
    LINK /tmp/perf/perf
    [root@emilia perf]#

    And then strictly required devel packages:

    [root@emilia perf]# rpm -e elfutils-libelf-devel elfutils-devel
    [root@emilia perf]# make -j9 O=/tmp/perf
    Makefile:509: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
    Makefile:542: *** No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel. Stop.
    [root@emilia perf]#

    After installing everything back on:

    [root@emilia perf]# yum install elfutils-devel binutils-devel newt-devel

    Installed:
    binutils-devel.x86_64 0:2.20.51.0.2-5.11.el6
    elfutils-devel.x86_64 0:0.147-1.el6
    elfutils-libelf-devel.x86_64 0:0.147-1.el6
    newt-devel.x86_64 0:0.52.11-1.el6

    Complete!
    [root@emilia perf]# make -j9
    PERF_VERSION = 0.0.2.PERF
    GEN common-cmds.h
    * new build flags or prefix
    GEN perf-archive
    CC builtin-annotate.o

    AR libperf.a
    LINK perf
    [root@emilia perf]# make -j9
    [root@emilia perf]#

    Thanks to Sam for pointing me to try-run.

    Cc: David S. Miller
    Cc: Frédéric Weisbecker
    Cc: Ingo Molnar
    Cc: Michal Marek
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Sam Ravnborg
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

18 May, 2010

2 commits


15 May, 2010

1 commit


12 May, 2010

1 commit

  • Now we don't anymore use popen to run 'perf annotate' for the selected
    symbol, instead we collect per address samplings when processing samples
    in 'perf report' if we're using the newt browser, then we use this data
    directly to do annotation.

    Done this way we can actually traverse the objdump_line objects
    directly, matching the addresses to the collected samples and colouring
    them appropriately using lower level slang routines.

    The new ui_browser class will be reused for the main, callchain aware,
    histogram browser, when it will be made generic and don't assume that
    the objects are always instances of the objdump_line class maintained
    using list_heads.

    Cc: Frédéric Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

11 May, 2010

2 commits

  • For Fedora, I want to force perf to link against libiberty.a for
    cplus_demangle, rather than libbfd.a for bfd_demangle due to licensing insanity
    on binutils. (libiberty is LGPL2, libbfd is GPL3.)

    If we just rely on autodetection, we'll end up with libbfd linked against us,
    since they're both in binutils-static in the buildroot.

    Cc: Ingo Molnar
    LKML-Reference:
    Signed-off-by: Kyle McMartin
    Signed-off-by: Arnaldo Carvalho de Melo

    Kyle McMartin
     
  • Check whether elfutils is older than 0.138 (from which version checking
    routine has been introduced). And if so, set NO_DWARF because it is hard
    to check the API dependency without version checking.

    Signed-off-by: Masami Hiramatsu
    Reported-by: Robert Richter
    Cc: Robert Richter
    Cc: Ingo Molnar
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

03 May, 2010

1 commit

  • Currently, perf 'live mode' writes build-ids at the end of the
    session, which isn't actually useful for processing live mode events.

    What would be better would be to have the build-ids sent before any of
    the samples that reference them, which can be done by processing the
    event stream and retrieving the build-ids on the first hit. Doing
    that in perf-record itself, however, is off-limits.

    This patch introduces perf-inject, which does the same job while
    leaving perf-record untouched. Normal mode perf still records the
    build-ids at the end of the session as it should, but for live mode,
    perf-inject can be injected in between the record and report steps
    e.g.:

    perf record -o - ./hackbench 10 | perf inject -v -b | perf report -v -i -

    perf-inject reads a perf-record event stream and repipes it to stdout.
    At any point the processing code can inject other events into the
    event stream - in this case build-ids (-b option) are read and
    injected as needed into the event stream.

    Build-ids are just the first user of perf-inject - potentially
    anything that needs userspace processing to augment the trace stream
    with additional information could make use of this facility.

    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Cc: Frédéric Weisbecker
    LKML-Reference:
    Signed-off-by: Tom Zanussi
    Signed-off-by: Arnaldo Carvalho de Melo

    Tom Zanussi
     

02 May, 2010

1 commit

  • We need to refactor code to be explicitely shared by the kernel and at
    least the tools/ userspace programs, so, till we do that, copy the bare
    minimum bitmap/bitops code needed by tools/perf.

    Reported-by: "H. Peter Anvin"
    Cc: Frédéric Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

30 Apr, 2010

1 commit

  • First an example with the first internal test:

    [acme@doppio linux-2.6-tip]$ perf test
    1: vmlinux symtab matches kallsyms: Ok

    So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
    successful.

    If we run it in verbose mode, we'll see details about errors and extra warnings
    for non-fatal problems:

    [acme@doppio linux-2.6-tip]$ perf test -v
    1: vmlinux symtab matches kallsyms:
    --- start ---
    Looking at the vmlinux_path (5 entries long)
    No build_id in vmlinux, ignoring it
    No build_id in /boot/vmlinux, ignoring it
    No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
    Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
    Maps only in vmlinux:
    ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
    ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
    ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
    ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
    ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
    ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
    Maps in vmlinux with a different name in kallsyms:
    ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
    ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
    *ffffffffff600100-ffffffffff60012f 0 [kernel].2
    ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
    ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
    Maps only in kallsyms:
    ffffffffff600130-ffffffffff6003ff 0 [kernel].4
    ---- end ----
    vmlinux symtab matches kallsyms: Ok
    [acme@doppio linux-2.6-tip]$

    In the above case we only know the name of the non contiguous kernel ranges in
    the address space when reading the symbol information from the ELF symtab in
    vmlinux.

    The /proc/kallsyms file lack this, we only notice they are separate because
    there are modules after the kernel and after that more kernel functions, so we
    need to have a module rbtree backed by the module .ko path to get symtabs in
    the vmlinux case.

    The tool uses it to match by address to emit appropriate warning, but don't
    considers this fatal.

    The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
    these cases just as extra info in verbose mode.

    The end of the sections also aren't in kallsyms, so we the symbols layer does
    another pass and sets the end addresses as the next map start minus one, which
    sometimes pads, causing harmless mismatches.

    But at least the symbols match, tested it by copying /proc/kallsyms to
    /tmp/kallsyms and doing changes to see if they were detected.

    This first test also should serve as a first stab at documenting the
    symbol library by providing a self contained example that exercises it
    together with comments about what is being done.

    More tests to check if actions done on a monitored app, like doing mmaps, etc,
    makes the kernel generate the expected events should be added next.

    Cc: Frédéric Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

28 Apr, 2010

1 commit


27 Apr, 2010

1 commit

  • The headers required for DWARF support are provided by the libdw-dev
    package in Debian-based distros. This patch corrects the elfutils-dev
    package name to libdw-dev in the Makefile error message when libdw.h is
    not found.

    Signed-off-by: Stefan Hajnoczi
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Masami Hiramatsu
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Stefan Hajnoczi
     

22 Apr, 2010

1 commit

  • The perf userspace tool included some architecture specific code to map
    registers from the DWARF register number into the names used by the regs
    and stack access API.

    This moves the architecture specific code out into a separate
    arch/x86 directory along with the infrastructure required to use it.

    Signed-off-by: Ian Munsie
    Acked-by: Masami Hiramatsu
    Signed-off-by: Paul Mackerras

    Ian Munsie
     

19 Apr, 2010

1 commit


10 Apr, 2010

1 commit


04 Apr, 2010

1 commit


03 Apr, 2010

4 commits


23 Mar, 2010

2 commits

  • Add NO_DWARF make option for testing build without libdw.

    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Frederic Weisbecker
    Cc: Paul Mackerras
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     
  • Cleanup debuginfo related code to eliminate fragile code which
    pointed by Ingo (Thanks!).
    1) Invert logic of NO_DWARF_SUPPORT to DWARF_SUPPORT.
    2) For removing assymetric/local variable ifdefs, introduce
    more helper functions.
    3) Change options order to reduce the number of ifdefs.

    Reported-by: Ingo Molnar
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Frederic Weisbecker
    Cc: Paul Mackerras
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     

12 Mar, 2010

1 commit

  • Newt has widespread availability and provides a rather simple
    API as can be seen by the size of this patch.

    The work needed to support it will benefit other frontends too.

    In this initial patch it just checks if the output is a tty, if
    not it falls back to the previous behaviour, also if
    newt-devel/libnewt-dev is not installed the previous behaviour
    is maintaned.

    Pressing enter on a symbol will annotate it, ESC in the
    annotation window will return to the report symbol list.

    More work will be done to remove the special casing in
    color_fprintf, stop using fmemopen/FILE in the printing of
    hist_entries, etc.

    Also the annotation doesn't need to be done via spawning "perf
    annotate" and then browsing its output, we can do better by
    calling directly the builtin-annotate.c functions, that would
    then be moved to tools/perf/util/annotate.c and shared with perf
    top, etc

    But lets go by baby steps, this patch already improves perf
    usability by allowing to quickly do annotations on symbols from
    the report screen and provides a first experimentation with
    libnewt/TUI integration of tools.

    Tested on RHEL5 and Fedora12 X86_64 and on Debian PARISC64 to
    browse a perf.data file collected on a Fedora12 x86_64 box.

    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Avi Kivity
    Cc: Frédéric Weisbecker
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Arnaldo Carvalho de Melo
     

11 Mar, 2010

2 commits

  • Without this change, the install path is relative to
    prefix/DESTDIR where prefix is automatically set to $HOME.

    This can produce unexpected results. For example:

    make -C tools/perf DESTDIR=/home/jkacur/tmp install-man

    creates the directory: /home/jkacur/home/jkacur/tmp/share/...
    instead of the expected: /home/jkacur/tmp/share/...

    Signed-off-by: John Kacur
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    Cc: Frederic Weisbecker
    Cc: Tom Zanussi
    Cc: Kyle McMartin
    Cc:
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    John Kacur
     
  • At present, the perf subcommands that do system-wide monitoring
    (perf stat, perf record and perf top) don't work properly unless
    the online cpus are numbered 0, 1, ..., N-1. These tools ask
    for the number of online cpus with sysconf(_SC_NPROCESSORS_ONLN)
    and then try to create events for cpus 0, 1, ..., N-1.

    This creates problems for systems where the online cpus are
    numbered sparsely. For example, a POWER6 system in
    single-threaded mode (i.e. only running 1 hardware thread per
    core) will have only even-numbered cpus online.

    This fixes the problem by reading the /sys/devices/system/cpu/online
    file to find out which cpus are online. The code that does that is in
    tools/perf/util/cpumap.[ch], and consists of a read_cpu_map()
    function that sets up a cpumap[] array and returns the number of
    online cpus. If /sys/devices/system/cpu/online can't be read or
    can't be parsed successfully, it falls back to using sysconf to
    ask how many cpus are online and sets up an identity map in cpumap[].

    The perf record, perf stat and perf top code then calls
    read_cpu_map() in the system-wide monitoring case (instead of
    sysconf) and uses cpumap[] to get the cpu numbers to pass to
    perf_event_open.

    Signed-off-by: Paul Mackerras
    Cc: Anton Blanchard
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul Mackerras
     

26 Feb, 2010

1 commit

  • Newer gcc introduces newer & richer debuginfo, and only libdw
    in elfutils project can support it. So perf probe moves onto
    elfutils-libdw from libdwarf.

    Changes in v3:
    - Cast Dwarf_Addr/Dwarf_Word to uintmax_t for printf-formats.
    - Recover a sign-prefix which was removed in v2 by mistake.

    Changes in v2:
    - Fix a type-casting bug in Makefile.
    - Cast Dwarf_Addr/Dwarf_Word to unsigned long long for printf-formats.

    Signed-off-by: Masami Hiramatsu
    Cc: systemtap
    Cc: DLE
    Cc: Frederic Weisbecker
    Cc: Arnaldo Carvalho de Melo
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Mike Galbraith
    Cc: K.Prasad
    Cc: Ulrich Drepper
    Cc: Roland McGrath
    Cc: Frederic Weisbecker
    Cc: Ananth N Mavinakayanahalli
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     

25 Feb, 2010

2 commits

  • Adds a set of scripts that aggregate system call totals and system
    call errors. Most are Python scripts that also test basic
    functionality of the new Python engine, but there's also one Perl
    script added for comparison and for reference in some new
    Documentation contained in a later patch.

    Signed-off-by: Tom Zanussi
    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Cc: Keiichi KII
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Tom Zanussi
     
  • Add base support for Python scripting to perf trace.

    Signed-off-by: Tom Zanussi
    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Cc: Keiichi KII
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Tom Zanussi
     

24 Feb, 2010

1 commit

  • Create a scripting-engines directory to contain scripting engine
    implementation code, in anticipation of the addition of new scripting
    support. Also removes trace-event-perl.h.

    Signed-off-by: Tom Zanussi
    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Cc: Keiichi KII
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Tom Zanussi