09 Dec, 2014

1 commit

  • There's no need to copy over the buildid_dir into separate variable with
    no change.

    This is leftover from commit:
    45de34bbe3e1 perf buildid: add perfconfig option to specify buildid cache dir

    that added global buildid_dir variable that holds cache directory, but
    did not cleanup the debugdir copies.

    Signed-off-by: Jiri Olsa
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1417460789-13874-3-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

19 Nov, 2014

1 commit

  • Also move static variable no_buildid_cache and check it in the
    perf_session_cache_build_ids().

    Signed-off-by: Namhyung Kim
    Cc: Aravinda Prasad
    Cc: Brendan Gregg
    Cc: Hemant Kumar
    Cc: Ingo Molnar
    Cc: Masami Hiramatsu
    Cc: Oleg Nesterov
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: Srikar Dronamraju
    Cc: Vasant Hegde
    Cc: systemtap@sourceware.org
    Link: http://lkml.kernel.org/r/1415368677-3794-1-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

05 Nov, 2014

1 commit

  • It'd be better managing those functions in a separate place as
    util/header.c file is already big.

    It now exports following 3 functions to others:

    bool perf_session__read_build_ids(struct perf_session *session, bool with_hits);
    int perf_session__write_buildid_table(struct perf_session *session, int fd);
    int perf_session__cache_build_ids(struct perf_session *session);

    Signed-off-by: Namhyung Kim
    Acked-by: Adrian Hunter
    Link: http://lkml.kernel.org/r/545733E7.6010105@intel.com
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1415063674-17206-5-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

29 Oct, 2014

1 commit

  • So stop passing both machine and thread to several thread methods,
    reducing function signature length.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jean Pihet
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-ckcy19dcp1jfkmdihdjcqdn1@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

12 May, 2014

1 commit

  • I believe that passing pid (instead of tid) as the 3rd arg of the
    machine__find*_thread() was to find a main thread so that it can
    search proper map group for symbols. However with the map sharing
    patch applied, it now can do it in any thread.

    It fixes a bug when each thread has different name, it only reports a
    main thread for samples in other threads.

    Cc: Adrian Hunter
    Acked-by: David Ahern
    Acked-by: Stephane Eranian
    Signed-off-by: Namhyung Kim
    Link: http://lkml.kernel.org/r/1399856202-26221-1-git-send-email-namhyung@kernel.org
    Signed-off-by: Jiri Olsa

    Namhyung Kim
     

11 Dec, 2013

1 commit

  • Those methods are not supposed to change the data structures they
    manipulate, so make that clearer by using the const qualifier in the
    function signature and in some variables.

    Suggested-by: Ingo Molnar
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-j7oyakex7zy3r82h33rdw25x@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

23 Oct, 2013

1 commit

  • As suggested by tglx, 'self' should be replaced by something that is
    more useful.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-fmblhc6tbb99tk1q8vowtsbj@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

11 Sep, 2013

1 commit

  • This patch adds support for the new PERF_RECORD_MMAP2 record type
    exposed by the kernel. This is an extended PERF_RECORD_MMAP record.

    It adds for each file-backed mapping the device major, minor number and
    the inode number and generation.

    This triplet uniquely identifies the source of a file-backed mapping. It
    can be used to detect identical virtual mappings between processes, for
    instance.

    The patch will prefer MMAP2 over MMAP.

    Signed-off-by: Stephane Eranian
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1377079825-19057-3-git-send-email-eranian@google.com
    [ Cope with 314add6 "Change machine__findnew_thread() to set thread pid",
    fix 'perf test' regression test entry affected,
    use perf_missing_features.mmap2 to fallback to not using .mmap2 in older kernels,
    so that new tools can work with kernels where this feature is not present ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Stephane Eranian
     

30 Aug, 2013

1 commit

  • The ip_event struct assumes fixed positions for ip, pid and tid. That
    is no longer true with the addition of PERF_SAMPLE_IDENTIFIER. The
    information is anyway in struct sample, so use that instead.

    Signed-off-by: Adrian Hunter
    Acked-by: Namhyung Kim
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1377591794-30553-5-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

29 Aug, 2013

1 commit

  • Add a new parameter for 'pid' to machine__findnew_thread().
    Change callers to pass 'pid' when it is known.

    Note that callers sometimes want to find the main thread
    which has the memory maps. The main thread has tid == pid
    so the usage in that case is:

    machine__findnew_thread(machine, pid, pid)

    whereas the usage to find the specific thread is:

    machine__findnew_thread(machine, pid, tid)

    Signed-off-by: Adrian Hunter
    Acked-by: David Ahern
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1377591794-30553-2-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

12 Aug, 2013

1 commit

  • Now that the symbol filter is recorded on the machine there is no need
    to pass it to thread__find_addr_map(). So remove it.

    Signed-off-by: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1375961547-30267-9-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

08 Aug, 2013

1 commit

  • In order to use kernel maps to read object code, those maps must be
    adjusted to map to the dso file offset. Because lazy-initialization is
    used, that is not done until symbols are loaded. However the maps are
    first used by thread__find_addr_map() before symbols are loaded. So
    this patch changes thread__find_addr() to "load" kernel maps before
    using them.

    Signed-off-by: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1375875537-4509-3-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

29 Oct, 2012

1 commit

  • Moving build_id__sprintf function into build-id object.

    Signed-off-by: Jiri Olsa
    Reviewed-by: Namhyung Kim
    Tested-by: Namhyung Kim
    Cc: Corey Ashford
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1351372712-21104-2-git-send-email-jolsa@redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

26 Oct, 2012

1 commit

  • Otherwise they will be not written in an output file.

    Signed-off-by: Andrew Vagin
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1344344165-369636-5-git-send-email-avagin@openvz.org
    [ committer note: Fixed up wrt changes made in the immediate previous patches ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Andrew Vagin
     

07 Oct, 2012

1 commit

  • When we were processing a PERF_RECORD_EXIT event we first used
    machine__findnew_thread for both the thread exiting and for its parent,
    only to use just the thread struct associated with the one exiting, and
    to just delete it.

    If it existed, i.e. not created at this very moment in
    machine__findnew_thread, it will be moved to the machine->dead_threads
    linked list, because we may have hist_entries pointing to it, but if it
    was created just do be deleted, it will just sit there with no
    references at all.

    Use the new machine__find_thread() method so that if it is not there, we
    don't create it.

    As a bonus the parent thread will also not be created at this point.

    Create process_fork() and process_exit() helpers to use this and make
    the builtins use it instead of the generic process_task(), ditched by
    this patch.

    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-z7n2y98ebjyrvmytaope4vdl@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

11 Sep, 2012

1 commit

  • perf defines both __used and __unused variables to use for marking
    unused variables. The variable __used is defined to
    __attribute__((__unused__)), which contradicts the kernel definition to
    __attribute__((__used__)) for new gcc versions. On Android, __used is
    also defined in system headers and this leads to warnings like: warning:
    '__used__' attribute ignored

    __unused is not defined in the kernel and is not a standard definition.
    If __unused is included everywhere instead of __used, this leads to
    conflicts with glibc headers, since glibc has a variables with this name
    in its headers.

    The best approach is to use __maybe_unused, the definition used in the
    kernel for __attribute__((unused)). In this way there is only one
    definition in perf sources (instead of 2 definitions that point to the
    same thing: __used and __unused) and it works on both Linux and Android.
    This patch simply replaces all instances of __used and __unused with
    __maybe_unused.

    Signed-off-by: Irina Tirdea
    Acked-by: Pekka Enberg
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1347315303-29906-7-git-send-email-irina.tirdea@intel.com
    [ committer note: fixed up conflict with a116e05 in builtin-sched.c ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Irina Tirdea
     

23 May, 2012

1 commit

  • In order for perf buildid-list to work with pipe-mode files, it needs to
    process buildids and event attr structs.

    $ perf record -o - noploop 2 | ./perf inject -b | perf buildid-list -i - -H
    noploop for 2 seconds
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.084 MB - (~3678 samples) ]
    0000000000000000000000000000000000000000 [kernel.kallsyms]
    3a0d0629efe74a8da3eeba372cdbd74ad9b8f5d5 /usr/local/bin/noploop

    The reason [kernel.kallsyms] shows a 0 build-id comes from the
    way buildids are injected in the stream.

    The buildid for the kernel is provided by a BUILD_ID record. The
    [kernel.kallsyms] is provided by a MMAP record. There is no clean and
    obvious way to link the two, unfortunately.

    In regular mode, the kernel buildid is generated from reading the ELF
    image or kallsyms and perf knows to associate [kernel.kallsyms] to it.
    Later on, when perf processes the [kernel.kallsyms] MMAP record, it will
    already have a dso for it.

    So for now, make sure perf buildid-list shows the buildids for
    everything but the kernel image.

    Signed-off-by: Stephane Eranian
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1337081295-10303-6-git-send-email-eranian@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Stephane Eranian
     

28 Nov, 2011

4 commits

  • To better reflect that it became the base class for all tools, that must
    be in each tool struct and where common stuff will be put.

    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-qgpc4msetqlwr8y2k7537cxe@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Reducing the exposure of perf_session further, so that we can use the
    classes in cases where no perf.data file is created.

    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-stua66dcscsezzrcdugvbmvd@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • So that we don't need to have that many globals.

    Next steps will remove the 'session' pointer, that in most cases is
    not needed.

    Then we can rename perf_event_ops to 'perf_tool' that better describes
    this class hierarchy.

    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-wp4djox7x6w1i2bab1pt4xxp@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • The 'machine' abstraction was introduced with 'perf kvm' where we could
    have samples for the host and multiple guests, but at the time we ended
    up keeping the list of all machines threads all in
    session->host_machine.

    Move the threads rb_tree to struct machine to separate the namespaces.

    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-mdg7sm6j3va09vtgj49gbsrp@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

24 Mar, 2011

1 commit

  • Resolving the sample->id to an evsel since the most advanced tools,
    report and annotate, and the others will too when they evolve to
    properly support multi-event perf.data files.

    Good also because it does an extra validation, checking that the ID is
    valid when present. When that is not the case, the overhead is just a
    branch + function call (perf_evlist__id2evsel).

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

30 Jan, 2011

2 commits


05 Dec, 2010

1 commit

  • At perf_session__process_event, so that we reduce the number of lines in eache
    tool sample processing routine that now receives a sample_data pointer already
    parsed.

    This will also be useful in the next patch, where we'll allow sample the
    identity fields in MMAP, FORK, EXIT, etc, when it will be possible to see (cpu,
    timestamp) just after before every event.

    Also validate callchains in perf_session__process_event, i.e. as early as
    possible, and keep a counter of the number of events discarded due to invalid
    callchains, warning the user about it if it happens.

    There is an assumption that was kept that all events have the same sample_type,
    that will be dealt with in the future, when this preexisting limitation will be
    removed.

    Tested-by: Thomas Gleixner
    Reviewed-by: Thomas Gleixner
    Acked-by: Ian Munsie
    Acked-by: Thomas Gleixner
    Cc: Frédéric Weisbecker
    Cc: Ian Munsie
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Stephane Eranian
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

31 Jul, 2010

1 commit

  • For long running sessions with many threads with short lifetimes the
    amount of memory that the buildid process takes is too much.

    Since we don't have hist_entries that may be pointing to them, we can
    just release the resources associated with each thread when the exit
    (PERF_RECORD_EXIT) event is received.

    For normal processing we need to annotate maps with hits, and thus
    hist_entries pointing to it and drop the ones that had none. Will be
    done in a followup patch.

    Cc: David S. Miller
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

05 Jun, 2010

1 commit

  • This patch adds the ability to specify an alternate directory to store the
    buildid cache (buildids, copy of binaries). By default, it is hardcoded to
    $HOME/.debug. This directory contains immutable data. The layout of the
    directory is such that no conflicts in filenames are possible. A modification
    in a file, yields a different buildid and thus a different location in the
    subdir hierarchy.

    You may want to put the buildid cache elsewhere because of disk space
    limitation or simply to share the cache between users. It is also useful for
    remote collect vs. local analysis of profiles.

    This patch adds a new config option to the perfconfig file. Under the tag
    'buildid', there is a dir option. For instance, if you have:

    $ cat /etc/perfconfig
    [buildid]
    dir = /var/cache/perf-buildid

    All buildids and binaries are be saved in the directory specified. The perf
    record, buildid-list, buildid-cache, report, annotate, and archive commands
    will it to pull information out.

    The option can be set in the system-wide perfconfig file or in the
    $HOME/.perfconfig file.

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

    Stephane Eranian
     

20 May, 2010

1 commit

  • We were still using the pathname found on the MMAP event, that could not
    be the one we used when recording, so use the build-id cache for that,
    only falling back to use the pathname in the MMAP event if no build-ids
    are available.

    With this we now also are able to do secure, seamless offline annotation.

    Example:

    [root@doppio linux-2.6-tip]# perf report -g none -v 2> /dev/null | head -10
    8.12% Xorg /usr/lib64/libpixman-1.so.0.14.0 0x0000000000026d02 B [.] pixman_rasterize_edges
    4.68% firefox /usr/lib64/xulrunner-1.9.1/libxul.so 0x00000000005dbdba B [.] 0x000000005dbdba
    3.70% swapper /lib/modules/2.6.34-rc6/build/vmlinux 0xffffffff81022cea ! [k] read_hpet
    2.96% init /lib/modules/2.6.34-rc6/build/vmlinux 0xffffffff81022cea ! [k] read_hpet
    2.73% swapper /lib/modules/2.6.34-rc6/build/vmlinux 0xffffffff8100a738 ! [k] mwait_idle_with_hints
    [root@doppio linux-2.6-tip]# perf annotate -v pixman_rasterize_edges 2>&1 | grep Executing
    Executing: objdump --start-address=0x000000371ce26670 --stop-address=0x000000371ce2709f -dS /root/.debug/.build-id/bd/6ac5199137aaeb279f864717d8d061477466c1|grep -v /root/.debug/.build-id/bd/6ac5199137aaeb279f864717d8d061477466c1|expand
    [root@doppio linux-2.6-tip]# perf buildid-list | grep libpixman-1.so.0.14.0
    bd6ac5199137aaeb279f864717d8d061477466c1 /usr/lib64/libpixman-1.so.0.14.0
    [root@doppio linux-2.6-tip]#

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

    Arnaldo Carvalho de Melo
     

19 Apr, 2010

1 commit


04 Feb, 2010

1 commit