1. 06 5月, 2015 1 次提交
    • A
      perf tools: Add support for PERF_RECORD_AUX · 4a96f7a0
      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: NAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1430404667-10593-7-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4a96f7a0
  2. 29 4月, 2015 2 次提交
  3. 10 4月, 2015 2 次提交
  4. 01 4月, 2015 2 次提交
  5. 02 3月, 2015 1 次提交
    • A
      perf tools: Fix FORK after COMM when synthesizing records for pre-existing threads · 4aa5f4f7
      Arnaldo Carvalho de Melo 提交于
      In this commit:
      
        commit 363b785f
        Author: Don Zickus <dzickus@redhat.com>
        Date:   Fri Mar 14 10:43:44 2014 -0400
      
            perf tools: Speed up thread map generation
      
      We ended up emitting PERF_RECORD_FORK events after their corresponding
      PERF_RECORD_COMM, so the code below will remove the "existing thread"
      and then recreates it, unnecessarily:
      
        [root@ssdandy ~]# perf probe -x ~/bin/perf -L machine__process_fork_event
        <machine__process_fork_event@/home/acme/git/linux/tools/perf/util/machine.c:0>
            0  int machine__process_fork_event(struct machine *machine, union perf_event *event,
                                              struct perf_sample *sample)
            2  {
            3         struct thread *thread = machine__find_thread(machine,
                                                                   event->fork.pid,
                                                                   event->fork.tid);
            6         struct thread *parent = machine__findnew_thread(machine,
                                                                      event->fork.ppid,
                                                                      event->fork.ptid);
      
                      /* if a thread currently exists for the thread id remove it */
                      if (thread != NULL)
           12                 machine__remove_thread(machine, thread);
      
           14         thread = machine__findnew_thread(machine, event->fork.pid,
                                                       event->fork.tid);
           16         if (dump_trace)
           17                 perf_event__fprintf_task(event, stdout);
      
           19         if (thread == NULL || parent == NULL ||
           20             thread__fork(thread, parent, sample->time) < 0) {
           21                 dump_printf("problem processing PERF_RECORD_FORK, skipping event.\n");
           22                 return -1;
                      }
      
           25         return 0;
           26  }
      
        [root@ssdandy ~]# perf probe -x ~/bin/perf fork_after_comm=machine__process_fork_event:12
        Added new event:
          probe_perf:fork_after_comm (on machine__process_fork_event:12 in /home/acme/bin/perf)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe_perf:fork_after_comm -aR sleep 1
      
        [root@ssdandy ~]#
      
        [root@ssdandy ~]# perf record -g -e probe_perf:* trace -o /tmp/bla
        ^C[ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.021 MB perf.data (30 samples) ]
        Terminated
        [root@ssdandy ~]#
      
        [root@ssdandy ~]# perf report --no-children --show-total-period --stdio
        # To display the perf.data header info, please use --header/--header-only options.
        #
        # Samples: 30  of event 'probe_perf:fork_after_comm'
        # Event count (approx.): 30
        #
        # Overhead        Period  Command  Shared Object  Symbol
        # ........  ............  .......  .............  ...............................
        #
           100.00%            30  trace    trace          [.] machine__process_fork_event
                      |
                      ---machine__process_fork_event
                         __event__synthesize_thread.part.2
                         perf_event__synthesize_threads
                         cmd_trace
                         main
                         __libc_start_main
      
        [root@ssdandy ~]#
      
        And Looking at 'perf report -D' output we see it:
      
        0 0 0x8698 [0x30]: PERF_RECORD_COMM: auditd:703/707
        0 0 0x86c8 [0x38]: PERF_RECORD_FORK(703:707):(703:703)
      
      Fix it by more closely mimicking how the kernel generates those records
      when a new fork happens, i.e. first a PERF_RECORD_FORK, then a
      PERF_RECORD_COMM.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-h0emvymi2t3mw8dlqd6d6z73@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4aa5f4f7
  6. 25 2月, 2015 1 次提交
  7. 29 10月, 2014 2 次提交
    • A
      perf tools: Add id index · 3c659eed
      Adrian Hunter 提交于
      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: NAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1414417770-18602-2-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3c659eed
    • A
      perf tools: A thread's machine can be found via thread->mg->machine · bb871a9c
      Arnaldo Carvalho de Melo 提交于
      So stop passing both machine and thread to several thread methods,
      reducing function signature length.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-ckcy19dcp1jfkmdihdjcqdn1@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bb871a9c
  8. 26 9月, 2014 1 次提交
  9. 23 8月, 2014 1 次提交
  10. 25 7月, 2014 1 次提交
  11. 17 7月, 2014 2 次提交
  12. 09 6月, 2014 2 次提交
  13. 12 5月, 2014 1 次提交
  14. 28 4月, 2014 1 次提交
    • A
      perf tools: Allocate thread map_groups's dynamically · 93d5731d
      Arnaldo Carvalho de Melo 提交于
      Moving towards sharing map groups within a process threads.
      
      Because of this we need the map groups to be dynamically allocated. No
      other functional change is intended in here.
      
      Based on a patch by Jiri Olsa, but this time _just_ making the
      conversion from statically allocating thread->mg to turning it into a
      pointer and instead of initializing it at thread's constructor,
      introduce a constructor/destructor for the map_groups class and
      call at thread creation time.
      
      Later we will introduce the get/put methods when we move to sharing
      those map_groups, when the get/put refcounting semantics will be needed.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@kernel.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1397490723-1992-3-git-send-email-jolsa@redhat.comSigned-off-by: NJiri Olsa <jolsa@kernel.org>
      93d5731d
  15. 19 3月, 2014 3 次提交
  16. 15 3月, 2014 1 次提交
  17. 14 3月, 2014 1 次提交
    • D
      perf tools: Fix synthesizing mmaps for threads · bfd66cc7
      Don Zickus 提交于
      Currently if a process creates a bunch of threads using pthread_create
      and then perf is run in system_wide mode, the mmaps for those threads
      are not captured with a synthesized mmap event.
      
      The reason is those threads are not visible when walking the /proc/
      directory looking for /proc/<pid>/maps files.  Instead they are
      discovered using the /proc/<pid>/tasks file (which the synthesized comm
      event uses).
      
      This causes problems when a program is trying to map a data address to a
      tid.  Because the tid has no maps, the event is dropped.  Changing the
      program to look up using the pid instead of the tid, finds the correct
      maps but creates ugly hacks in the program to carry the correct tid
      around.
      
      Fix this by moving the walking of the /proc/<pid>/tasks up a level (out
      of the comm function) based on Arnaldo's suggestion.
      
      Tweaked things a bit to special case the 'full' bit and 'guest' check.
      Signed-off-by: NDon Zickus <dzickus@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1393429527-167840-2-git-send-email-dzickus@redhat.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bfd66cc7
  18. 01 2月, 2014 2 次提交
  19. 13 1月, 2014 1 次提交
  20. 24 12月, 2013 5 次提交
  21. 20 12月, 2013 1 次提交
    • A
      perf symbols: Add 'machine' member to struct addr_location · cc22e575
      Arnaldo Carvalho de Melo 提交于
      The addr_location struct should fully qualify an address, and to do that
      it should have in it the machine where the thread was found.
      
      Thus all functions that receive an addr_location now don't need to also
      receive a 'machine', those functions just need to access al->machine
      instead, just like it does with the other parts of an address location:
      al->thread, al->map, etc.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-o51iiee7vyq4r3k362uvuylg@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cc22e575
  22. 13 12月, 2013 1 次提交
  23. 28 11月, 2013 1 次提交
  24. 15 11月, 2013 1 次提交
    • D
      perf tools: Synthesize anon MMAP records again · 9d4ecc88
      Don Zickus 提交于
      When introducing the PERF_RECORD_MMAP2 in:
      
      5c5e854b perf tools: Add attr->mmap2 support
      
      A check for the number of entries parsed by sscanf was introduced that
      assumed all of the 8 fields needed to be correctly parsed so that
      particular /proc/pid/maps line would be considered synthesizable.
      
      That broke anon records synthesizing, as it doesn't have the 'execname'
      field.
      
      Fix it by keeping the sscanf return check, changing it to not require
      that the 'execname' variable be parsed, so that the preexisting logic
      can kick in and set it to '//anon'.
      
      This should get things like JIT profiling working again.
      Signed-off-by: NDon Zickus <dzickus@redhat.com>
      Cc: Bill Gray <bgray@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joe Mario <jmario@redhat.com>
      Cc: Richard Fowles <rfowles@redhat.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/n/tip-bo4akalno7579shpz29u867j@git.kernel.org
      [ commit log message is mine, dzickus reported the problem with a patch ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9d4ecc88
  25. 12 11月, 2013 1 次提交
  26. 06 11月, 2013 1 次提交
  27. 04 11月, 2013 1 次提交