25 Apr, 2017

1 commit


21 Apr, 2017

1 commit


20 Apr, 2017

1 commit

  • Removing it from util.h, part of an effort to disentangle the includes
    hell, that makes changes to util.h or something included by it to cause
    a complete rebuild of the tools.

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

    Arnaldo Carvalho de Melo
     

12 Apr, 2017

1 commit

  • All paths following perf_session__process_event() in __cmd_inject() are
    useless if __cmd_inject() is to fail, some depend on a correct
    session->evlist.

    First commit to add code that depends on session->evlist without checking
    error was commmit e558a5bd8b ("perf inject: Work with files"). It has
    grown since then.

    Change __cmd_inject() to fail immediately after
    perf_session__process_event() fails.

    Signed-off-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Andrew Vagin
    Cc: He Kuang
    Cc: Masami Hiramatsu
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Simon Que
    Cc: Stephane Eranian
    Cc: Wang Nan
    Fixes: e558a5bd8b74 ("perf inject: Work with files")
    Link: http://lkml.kernel.org/r/20170410201432.24807-2-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     

27 Mar, 2017

1 commit

  • We got it from the git sources but never used it for anything, with the
    place where this would be somehow used remaining:

    static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
    {
    prefix = NULL;
    if (p->option & RUN_SETUP)
    prefix = NULL; /* setup_perf_directory(); */

    Ditch it.

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

    Arnaldo Carvalho de Melo
     

14 Mar, 2017

1 commit

  • Introduce a new option to record PERF_RECORD_NAMESPACES events emitted
    by the kernel when fork, clone, setns or unshare are invoked. And update
    perf-record documentation with the new option to record namespace
    events.

    Committer notes:

    Combined it with a later patch to allow printing it via 'perf report -D'
    and be able to test the feature introduced in this patch. Had to move
    here also perf_ns__name(), that was introduced in another later patch.

    Also used PRIu64 and PRIx64 to fix the build in some enfironments wrt:

    util/event.c:1129:39: error: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'long long unsigned int' [-Werror=format=]
    ret += fprintf(fp, "%u/%s: %lu/0x%lx%s", idx
    ^
    Testing it:

    # perf record --namespaces -a
    ^C[ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 1.083 MB perf.data (423 samples) ]
    #
    # perf report -D

    3 2028902078892 0x115140 [0xa0]: PERF_RECORD_NAMESPACES 14783/14783 - nr_namespaces: 7
    [0/net: 3/0xf0000081, 1/uts: 3/0xeffffffe, 2/ipc: 3/0xefffffff, 3/pid: 3/0xeffffffc,
    4/user: 3/0xeffffffd, 5/mnt: 3/0xf0000000, 6/cgroup: 3/0xeffffffb]

    0x1151e0 [0x30]: event: 9
    .
    . ... raw event: size 48 bytes
    . 0000: 09 00 00 00 02 00 30 00 c4 71 82 68 0c 7f 00 00 ......0..q.h....
    . 0010: a9 39 00 00 a9 39 00 00 94 28 fe 63 d8 01 00 00 .9...9...(.c....
    . 0020: 03 00 00 00 00 00 00 00 ce c4 02 00 00 00 00 00 ................

    NAMESPACES events: 1

    #

    Signed-off-by: Hari Bathini
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Alexei Starovoitov
    Cc: Ananth N Mavinakayanahalli
    Cc: Aravinda Prasad
    Cc: Brendan Gregg
    Cc: Daniel Borkmann
    Cc: Eric Biederman
    Cc: Peter Zijlstra
    Cc: Sargun Dhillon
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/148891930386.25309.18412039920746995488.stgit@hbathini.in.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Hari Bathini
     

05 Sep, 2016

1 commit

  • We're not using it anymore, few users were, but we really could do
    without it, simplify lots of functions by removing it.

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

    Arnaldo Carvalho de Melo
     

23 Jun, 2016

1 commit


31 Mar, 2016

1 commit

  • Intel PT uses the time members from the perf_event_mmap_page to convert
    between TSC and perf time.

    Due to a lack of foresight when Intel PT was implemented, those time
    members were recorded in the (implementation dependent) AUXTRACE_INFO
    event, the structure of which is generally inaccessible outside of the
    Intel PT decoder. However now the conversion between TSC and perf time
    is needed when processing a jitdump file when Intel PT has been used for
    tracing.

    So add a user event to record the time members. 'perf record' will
    synthesize the event if the information is available. And session
    processing will put a copy of the event on the session so that tools
    like 'perf inject' can easily access it.

    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1457426324-30158-1-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

23 Mar, 2016

2 commits

  • To avoid parsing event->header.misc in many locations.

    This will also allow setting perf.sample.{ip,cpumode} in a single place,
    from tracepoint fields, as needed by 'perf kvm' with PPC guests, where
    the guest hardware counters is not available at the host.

    Cc: Adrian Hunter
    Cc: Hemant Kumar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Naveen N. Rao
    Cc: Ravi Bangoria
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-qp3yradhyt6q3wl895b1aat0@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • All over the tree.

    Cc: David Ahern
    cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Ravi Bangoria
    Link: http://lkml.kernel.org/n/tip-8nzhnokxyp8y4v7gf0j00oyb@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

11 Mar, 2016

1 commit

  • Build jitdump only on architectures defined in util/genelf.h file, to avoid
    breaking the build on such arches.

    Signed-off-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Borislav Petkov
    Cc: Colin Ian King
    Cc: David Ahern
    Cc: Davidlohr Bueso
    Cc: He Kuang
    Cc: Mel Gorman
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Steven Rostedt
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20160310164113.GA11357@krava.redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

09 Mar, 2016

1 commit

  • While building on a Docker container for ubuntu and installing package
    by package one ends up with:

    MKDIR /tmp/build/util/
    CC /tmp/build/util/genelf.o
    util/genelf.c:22:19: fatal error: dwarf.h: No such file or directory
    #include
    ^
    compilation terminated.
    mv: cannot stat '/tmp/build/util/.genelf.o.tmp': No such file or directory

    Because the jitdump code needs the DWARF related development packages to
    be installed. So make it dependent on that so that the build can succeed
    without jitdump support.

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

    Arnaldo Carvalho de Melo
     

08 Mar, 2016

3 commits

  • Move clockid validation into jit_process() so it can later be made
    conditional.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1457005856-6143-6-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Ingo Molnar

    Adrian Hunter
     
  • In preparation for moving clockid validation into jit_process().

    Previously a return value of zero meant the processing had been done and
    non-zero meant either the processing was not done (i.e. not the jitdump
    file mmap event) or an error occurred.

    Change it so that zero means the processing was not done, one means the
    processing was done and successful, and negative values are an error.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1457005856-6143-5-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Ingo Molnar

    Adrian Hunter
     
  • Currently, when injecting build ids, if there is AUX data then 'perf
    inject' hits all DSOs because it is not known which DSOs the trace data
    would hit.

    That needs to be done for JIT injection also, and in fact there is no
    reason to distinguish what kind of injection is being done. That is,
    any time there is AUX data and the HEADER_BUID_ID feature flag is set,
    and the AUX data is not being processed, then hit all DSOs. This patch
    does that.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1457005856-6143-2-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Ingo Molnar

    Adrian Hunter
     

05 Feb, 2016

2 commits

  • This patch adds a --jit/-j option to perf inject.

    This options injects MMAP records into the perf.data file to cover the
    jitted code mmaps. It also emits ELF images for each function in the
    jidump file. Those images are created where the jitdump file is. The
    MMAP records point to that location as well.

    Typical flow:

    $ perf record -k mono -- java -agentpath:libpjvmti.so java_class
    $ perf inject --jit -i perf.data -o perf.data.jitted
    $ perf report -i perf.data.jitted

    Note that jitdump.h support is not limited to Java, it works with any
    jitted environment modified to emit the jitdump file format, include
    those where code can be jitted multiple times and moved around.

    The jitdump.h format is adapted from the Oprofile project.

    The genelf.c (ELF binary generation) depends on MD5 hash encoding for
    the buildid. To enable this, libssl-dev must be installed. If not, then
    genelf.c defaults to using urandom to generate the buildid, which is not
    ideal. The Makefile auto-detects the presence on libssl-dev.

    This version mmaps the jitdump file to create a marker MMAP record in
    the perf.data file. The marker is used to detect jitdump and cause perf
    inject to inject the jitted mmaps and generate ELF images for jitted
    functions.

    In V8, the following fixes and changes were made among other things:

    - the jidump header format include a new flags field to be used
    to carry information about the configuration of the runtime agent.
    Contributed by: Adrian Hunter

    - Fix mmap pgoff: MMAP event pgoff must be the offset within the ELF file
    at which the code resides.
    Contributed by: Adrian Hunter

    - Fix ELF virtual addresses: perf tools expect the ELF virtual addresses of dynamic
    objects to match the file offset.
    Contributed by: Adrian Hunter

    - JIT MMAP injection does not obey finished_round semantics. JIT MMAP injection injects all
    MMAP events in one go, so it does not obey finished_round semantics, so drop the
    finished_round events from the output perf.data file.
    Contributed by: Adrian Hunter

    Signed-off-by: Stephane Eranian
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Carl Love
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: John McCutchan
    Cc: Namhyung Kim
    Cc: Pawel Moll
    Cc: Peter Zijlstra
    Cc: Sonny Rao
    Cc: Sukadev Bhattiprolu
    Link: http://lkml.kernel.org/r/1448874143-7269-3-git-send-email-eranian@google.com
    [ Moved inject.build_ids ordering bits to a separate patch, fixed the NO_LIBELF=1 build ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Stephane Eranian
     
  • To make sure the mmap records are ordered correctly and so that the
    correct especially due to jitted code mmaps.

    We cannot generate the buildid hit list and inject the jit mmaps (will
    come right after this patch) in at the same time for now.

    Signed-off-by: Stephane Eranian
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Carl Love
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: John McCutchan
    Cc: Namhyung Kim
    Cc: Pawel Moll
    Cc: Peter Zijlstra
    Cc: Sonny Rao
    Cc: Sukadev Bhattiprolu
    Link: http://lkml.kernel.org/r/1448874143-7269-3-git-send-email-eranian@google.com
    [ Carved out from a larger patch ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

18 Dec, 2015

1 commit

  • Move the subcommand-related files from perf to a new library named
    libsubcmd.a.

    Since we're moving files anyway, go ahead and rename 'exec_cmd.*' to
    'exec-cmd.*' to be consistent with the naming of all the other files.

    Signed-off-by: Josh Poimboeuf
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/c0a838d4c878ab17fee50998811612b2281355c1.1450193761.git.jpoimboe@redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Josh Poimboeuf
     

13 Nov, 2015

1 commit


29 Sep, 2015

3 commits

  • Add a new option --strip which is used with --itrace to strip out
    non-synthesized events. This results in a perf.data file that is
    simpler for external tools to parse. In particular, this can be used to
    prepare a perf.data file for consumption by autofdo.

    A subsequent patch makes a change to Intel PT also to enable use with
    autofdo and gives an example of that use.

    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1443186956-18718-25-git-send-email-adrian.hunter@intel.com
    [ Made it use perf_evlist__remove() + perf_evsel__delete() ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • perf inject can process instruction traces (using the --itrace option)
    which removes aux-related events and replaces them with the requested
    synthesized events.

    However there are still some leftovers, namely PERF_RECORD_ITRACE_START
    events and the original evsel (selected event) e.g. intel_pt//

    For the sake of completeness, remove them too.

    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1443186956-18718-24-git-send-email-adrian.hunter@intel.com
    [ Made it use perf_evlist__remove() + perf_evsel__delete() ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • The branch stack feature flag is set by 'perf record' when recording
    data that contains branch stacks. Consequently, when 'perf inject'
    synthesizes branch stacks, the feature flag should be set also.

    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1443186956-18718-13-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

24 Jul, 2015

1 commit

  • Support processing of PERF_RECORD_SWITCH events and
    PERF_RECORD_SWITCH_CPU_WIDE events. There is a single
    tools callback for them both so that the tool must
    check the event type before using the extra members
    in PERF_RECORD_SWITCH_CPU_WIDE.

    There is still no way to select the events, though.
    That is added in a subsequest patch.

    Signed-off-by: Adrian Hunter
    Acked-by: Peter Zijlstra (Intel)
    Tested-by: Jiri Olsa
    Cc: Andi Kleen
    Cc: Mathieu Poirier
    Cc: Pawel Moll
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1437471846-26995-3-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

02 Jul, 2015

1 commit

  • When an error occur an error value is just returned without freeing the
    session. So allocating and freeing session have to be matched as a pair
    even if an error occurs.

    Signed-off-by: Taeung Song
    Acked-by: Jiri Olsa
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/1435652124-22414-2-git-send-email-treeze.taeung@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Taeung Song
     

09 May, 2015

1 commit

  • In addition to using refcounts for the struct thread lifetime
    management, we need to protect access to machine->threads from
    concurrent access.

    That happens in 'perf top', where a thread processes events, inserting
    and deleting entries from that rb_tree while another thread decays
    hist_entries, that end up dropping references and ultimately deleting
    threads from the rb_tree and releasing its resources when no further
    hist_entry (or other data structures, like in 'perf sched') references
    it.

    So the rule is the same for refcounts + protected trees in the kernel,
    get the tree lock, find object, bump the refcount, drop the tree lock,
    return, use object, drop the refcount if no more use of it is needed,
    keep it if storing it in some other data structure, drop when releasing
    that data structure.

    I.e. pair "t = machine__find(new)_thread()" with a "thread__put(t)", and
    "perf_event__preprocess_sample(&al)" with "addr_location__put(&al)".

    The addr_location__put() one is because as we return references to
    several data structures, we may end up adding more reference counting
    for the other data structures and then we'll drop it at
    addr_location__put() time.

    Acked-by: David Ahern
    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-bs9rt4n0jw3hi9f3zxyy3xln@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

06 May, 2015

3 commits

  • Add support for the PERF_RECORD_ITRACE_START event type. This event can
    be used to determine the pid and tid that are running when Instruction
    Tracing starts. Generally that information would come from a
    sched_switch event but, at the start, no sched_switch events may yet
    have been recorded.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-8-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Add support for the PERF_RECORD_AUX event type.

    PERF_RECORD_AUX is a new kernel event that records when new data lands
    in the AUX buffer. Currently it is assumed that AUX data follows the
    same ring buffer conventions used by the perf events buffer, and
    consequently the AUX event is not processed during recording.

    It is processed during session processing so that the information in the
    'flags' member is made available.

    The format of PERF_RECORD_AUX is outlined in the linux/perf_events.h
    header file. The 'flags' are also enumerated.

    Intel PT and Intel BTS use the flag named PERF_AUX_FLAG_TRUNCATED to
    determine if data has been lost because the buffer became full as perf
    was not able to empty it fast enough.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-7-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Add build option NO_AUXTRACE to exclude compiling support for AUX area
    tracing. Support for both recording and processing is excluded and by
    implication any future additions such as Intel PT and Intel BTS will
    also not be compiled in with this option.

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

    Adrian Hunter
     

05 May, 2015

2 commits

  • We need to include all buildids when a perf.data file contains AUX area
    tracing data because we do not decode the trace for that purpose because
    it would take too long.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-4-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Add an index of AUX area tracing events within a perf.data file.

    perf record uses a special user event PERF_RECORD_FINISHED_ROUND to
    enable sorting of events in chunks instead of having to sort all events
    altogether.

    AUX area tracing events contain data that can span back to the very
    beginning of the recording period. i.e. they do not obey the rules of
    PERF_RECORD_FINISHED_ROUND.

    By adding an index, AUX area tracing events can be found in advance and
    the PERF_RECORD_FINISHED_ROUND approach works as usual.

    The index is recorded with the auxtrace feature in the perf.data file.
    A session reads the index but does not process it. An AUX area decoder
    can queue all the AUX area data in advance using
    auxtrace_queues__process_index() or otherwise process the index in some
    custom manner.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-3-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

29 Apr, 2015

2 commits

  • Add support for decoding an AUX area assuming it contains instruction
    tracing data. The AUX area tracing events are stripped and replaced by
    synthesized events.

    Signed-off-by: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1428594864-29309-21-git-send-email-adrian.hunter@intel.com
    [ Do not use -Z as an alternative to --itrace ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • New AUX area tracing events must be re-piped by default.

    Signed-off-by: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1429608114-18194-1-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

03 Apr, 2015

1 commit

  • Enable perf inject to use perf.data when it is not owned by current user
    or root.

    Example:

    # perf record ls
    # chown Yunlong.Song:Yunlong.Song perf.data
    # ls -al perf.data
    -rw------- 1 Yunlong.Song Yunlong.Song 28260 Apr 2 10:37 perf.data
    # id
    uid=0(root) gid=0(root) groups=0(root),64(pkcs11)

    Before this patch:

    # perf inject -v -b -i perf.data -o perf.data.new
    File perf.data not owned by current user or root (use -f to override)
    # perf inject -v -b -i perf.data -o perf.data.new -f
    Error: unknown switch `f'

    usage: perf inject []

    -b, --build-ids Inject build-ids into the output stream
    -i, --input input file name
    -o, --output output file name
    -s, --sched-stat Merge sched-stat and sched-switch for getting
    events where and how long tasks slept
    -v, --verbose be more verbose (show build ids, etc)
    --kallsyms
    kallsyms pathname

    As shown above, the -f option does not work at all.

    After this patch:

    # perf inject -v -b -i perf.data -o perf.data.new
    File perf.data not owned by current user or root (use -f to override)
    # perf inject -v -b -i perf.data -o perf.data.new -f
    build id event received for [kernel.kallsyms]:
    f6dcb66d8b98f1c0d9eb87bf043444b69f91d30c
    symsrc__init: cannot get elf header.
    Looking at the vmlinux_path (7 entries long)
    Using /proc/kcore for kernel object code
    Using /proc/kallsyms for symbols

    As shown above, the -f option really works now.

    Signed-off-by: Yunlong Song
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1427982439-27388-3-git-send-email-yunlong.song@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Yunlong Song
     

12 Mar, 2015

1 commit


11 Mar, 2015

1 commit

  • By keeping pointers to machines, evlist and tool in ordered_events.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-0c6huyaf59mqtm2ek9pmposl@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

30 Jan, 2015

1 commit

  • Do not reference file->fd directly since we want hide the
    implementation details from outside for possible future changes.

    Signed-off-by: Namhyung Kim
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1422518843-25818-8-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

29 Oct, 2014

2 commits

  • Add an index of the event identifiers, in preparation for Intel PT.

    The event id (also called the sample id) is a unique number
    allocated by the kernel to the event created by perf_event_open(). Events
    can include the event id by having a sample type including PERF_SAMPLE_ID or
    PERF_SAMPLE_IDENTIFIER.

    Currently the main use of the event id is to match an event back to the
    evsel to which it belongs i.e. perf_evlist__id2evsel()

    The purpose of this patch is to make it possible to match an event back to
    the mmap from which it was read. The reason that is useful is because the
    mmap represents a time-ordered context (either for a cpu or for a thread).
    Intel PT decodes trace information on that basis. In full-trace mode, that
    information can be recorded when the Intel PT trace is read, but in
    sample-mode the Intel PT trace data is embedded in a sample and it is in
    that case that the "id index" is needed.

    So the mmaps are numbered (idx) and the cpu and tid recorded against the id
    by perf_evlist__set_sid_idx() which is called by perf_evlist__mmap_per_evsel().

    That information is recorded on the perf.data file in the new "id index".
    idx, cpu and tid are added to struct perf_sample_id (which is the node of
    evlist's hash table to match ids to evsels). The information can be
    retrieved using perf_evlist__id2sid(). Note however this all depends on
    having a sample type including PERF_SAMPLE_ID or PERF_SAMPLE_IDENTIFIER,
    otherwise ids are not recorded.

    The "id index" is a synthesized event record which will be created when
    Intel PT sampling is used by calling perf_event__synthesize_id_index().

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

    Adrian Hunter
     
  • 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
     

26 Sep, 2014

1 commit

  • Because perf_session__new() can fail for more reasons than just ENOMEM,
    modify error code(ENOMEM or EINVAL) to -1.

    Signed-off-by: Taeung Song
    Acked-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/1411522417-9917-1-git-send-email-treeze.taeung@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Taeung Song