Skip to content
  1. Aug 12, 2009
    • Jens Axboe's avatar
      perf record: Add missing -C option support for specifying profile cpu · 0a5ac846
      Jens Axboe authored
      
      
      perf top supports a -C for setting the profile CPU, but perf
      record does not. This adds the same option for perf record,
      allowing the user to specify a specific target profile CPU.
      
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090812091801.GC12579@kernel.dk>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0a5ac846
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Fix dso__new handle() to handle deleted DSOs · 1340e6bb
      Arnaldo Carvalho de Melo authored
      
      
      It is better than showing the map addr, this way at least we
      know that we can't get the symtabs because the DSO was deleted
      (system update) while an app still used such DSO.
      
      Yeah, don't do that, but if you do, you'll figure it out
      quicker this way.
      
      [acme@doppio linux-2.6-tip]$ perf report | head -15
       # Samples: 3796
       #
       # Overhead  Command                                                        Shared Object  Symbol
       # ........  .......  ...................................................................  ......
       #
          23.55%   pidgin  /lib64/libglib-2.0.so.0.2000.4.#prelink#.Pd98lu (deleted)            [.] 0x00000000038844
          21.55%   pidgin  /lib64/libpthread-2.10.1.so.#prelink#.AFwK8Q (deleted)               [.] 0x0000000000a42d
          10.85%   pidgin  [kernel]                                                             [.] vread_hpet
           7.85%   pidgin  /lib64/libgobject-2.0.so.0.2000.4.#prelink#.o1vpU7 (deleted)         [.] 0x00000000014de8
           3.35%   pidgin  /lib64/libc-2.10.1.so (deleted)                                      [.] 0x0000000007a875
           3.19%   pidgin  /lib64/libdbus-1.so.3.4.0.#prelink#.6mwgZP (deleted)                 [.] 0x0000000001d254
           3.06%   pidgin  /usr/lib64/libgtk-x11-2.0.so.0.1600.5.#prelink#.511hAl (deleted)     [.] 0x000000002334e7
           2.90%   pidgin  /usr/lib64/libgdk-x11-2.0.so.0.1600.5.#prelink#.5qlMo1 (deleted)     [.] 0x00000000037b2d
           1.84%   pidgin  [kernel]                                                             [k] do_sys_poll
           1.45%   pidgin  /usr/lib64/libX11.so.6.2.0.#prelink#.iR59Rx (deleted)                [.] 0x0000000004c751
      [acme@doppio linux-2.6-tip]$
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Luis Claudio R. Gonçalves <lclaudio@redhat.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090811200436.GA3478@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      1340e6bb
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Fix fallback to cplus_demangle() when bfd_demangle() is not available · 247648e3
      Arnaldo Carvalho de Melo authored
      
      
      In old binutils we can't access bfd_demangle(), use
      cplus_demangle() just like oprofile.
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Luis Claudio R. Gonçalves <lclaudio@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090811192211.GG18061@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      247648e3
    • Arnaldo Carvalho de Melo's avatar
      perf report: Show the tid too in -D · 94a24752
      Arnaldo Carvalho de Melo authored
      
      
      This made it easier to find the firefox threading related
      bug.
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090811192138.GE18061@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      94a24752
    • Arnaldo Carvalho de Melo's avatar
      perf record: Fix .tid and .pid fill-in when synthesizing events · 2a8083f0
      Arnaldo Carvalho de Melo authored
      
      
      Noticed when trying to record events for a firefox thread. We
      were synthesizing both .tid and .pid with the pid passed via
      --pid.
      
      Fix it by reading /proc/PID/status and getting the tgid
      to use in .pid, .tid gets the specified "pid".
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <20090811192200.GF18061@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2a8083f0
  2. Aug 11, 2009
  3. Aug 10, 2009
  4. Aug 09, 2009
    • Frederic Weisbecker's avatar
      perf tools: callchain: Fix bad rounding of minimum rate · c0a8865e
      Frederic Weisbecker authored
      
      
      Sometimes we get callchain branches that have a rate under the
      limit given by the user.
      
      Say you launched:
      
       perf record -f -g -a ./hackbench 10
       perf report -g fractal,10.0
      
      And you got:
      
      2.33%       hackbench  [kernel]                  [k] _spin_lock_irqsave
                      |
                      |--78.57%-- remove_wait_queue
                      |          poll_freewait
                      |          do_sys_poll
                      |          sys_poll
                      |          sysenter_dispatch
                      |          0xf7ffa430
                      |          0x1ffadea3c
                      |
                      |--7.14%-- __up_read
                      |          up_read
                      |          do_page_fault
                      |          page_fault
                      |          0xf7ffa430
                      |          0xa0df710000000a
                      ...
      
      It is abnormal to get a 7.14% branch whereas we passed a 10%
      filter.
      
      The problem is that we round down the minimum threshold. This
      happens mostly when we have very low number of events. If the
      total amount of your branch is 4 and you have a subranch of 3
      events, filtering to 90% will be computed like follows:
      
        limit = 4 * 0.9;
      
      The result is about 3.6, but the cast to integer will round
      down to 3. It means that our filter is actually of 75%
      
      We must then explicitly round up the minimum threshold.
      
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: acme@redhat.com
      Cc: peterz@infradead.org
      Cc: efault@gmx.de
      LKML-Reference: <20090809024235.GA10146@nowhere>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c0a8865e
    • Mike Galbraith's avatar
      perf_counter tools: Fix libbfd detection for systems with libz dependency · 183f3b08
      Mike Galbraith authored
      
      
      Due to a libz dependency in some distro's binutils package,
      C++ demangle support isn't compiled in despite the necessary
      libraries being available.
      
      Fix this by adding a -lz link test to the dependency detection
      rules.
      
      Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
      Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1249733655.6929.5.camel@marge.simson.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      183f3b08
    • Carlos R. Mafra's avatar
      perf: "Longum est iter per praecepta, breve et efficax per exempla" · c24b5133
      Carlos R. Mafra authored
      A few examples of how 'perf' can be used, from an e-mail by
      Ingo Molnar http://lkml.org/lkml/2009/8/4/346
      
      .
      
      Signed-off-by: default avatarCarlos R. Mafra <crmafra2@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Valdis.Kletnieks@vt.edu
      LKML-Reference: <20090805185334.GA4535@Pilar.aei.mpg.de>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c24b5133
    • Peter Zijlstra's avatar
      perf_counter: Fix a race on perf_counter_ctx · 3a80b4a3
      Peter Zijlstra authored
      
      
      While extending perfcounters with BTS hw-tracing, Markus
      Metzger managed to trigger this warning:
      
         [  995.557128] WARNING: at kernel/perf_counter.c:1191 __perf_counter_task_sched_out+0x48/0x6b()
      
      triggers because commit
      9f498cc5 (perf_counter: Full
      task tracing) removed clearing of tsk->perf_counter_ctxp out
      from under ctx->lock which introduced a race (against
      perf_lock_task_context).
      
      Move it back and deal with the exit notification by explicitly
      passing along the former task context.
      
      Reported-by: default avatarMarkus T Metzger <markus.t.metzger@intel.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1249667341.17467.5.camel@twins>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3a80b4a3
    • Frederic Weisbecker's avatar
      perf_counter: Fix tracepoint sampling to be part of generic sampling · 3a43ce68
      Frederic Weisbecker authored
      
      
      Based on Peter's comments, make tracepoint sampling generic
      just like all the other sampling bits are. This is a rename
      with no code changes:
      
      - PERF_SAMPLE_TP_RECORD to PERF_SAMPLE_RAW
      - struct perf_tracepoint_record to perf_raw_record
      
      We want the system in place that transport tracepoints raw
      samples events into the perf ring buffer to be generalized and
      usable by any type of counter.
      
      Reported-by; Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1249698400-5441-4-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3a43ce68
    • Frederic Weisbecker's avatar
      perf_counter: Work around gcc warning by initializing tracepoint record unconditionally · 10b8e306
      Frederic Weisbecker authored
      
      
      Despite that the tracepoint record is always present when the
      PERF_SAMPLE_TP_RECORD flag is set, gcc raises a warning,
      thinking it might not be initialized:
      
        kernel/perf_counter.c: In function ‘perf_counter_output’:
        kernel/perf_counter.c:2650: warning: ‘tp’ may be used uninitialized in this function
      
      Then, initialize it to NULL and always check if it's not NULL
      before dereference it.
      
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1249698400-5441-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      10b8e306
    • Frederic Weisbecker's avatar
      perf tools: callchain: Fix sum of percentages to be 100% by displaying amount... · 25446036
      Frederic Weisbecker authored
      
      perf tools: callchain: Fix sum of percentages to be 100% by displaying amount of ignored chains in fractal mode
      
      When we filter the callchains below a given percentage, we
      ignore them and the end result only shows entries that have an
      upper percentage than the filter threshold.
      
      It seems to users then that we have an imbalance in the
      percentage, as if the sum inside a profiled branch doesn't
      reach 100%.
      
      Since in the past there have been real perf report bugs that
      showed the same sypmtom, it would be nice to assure the user
      that the data is perfect and trustable and it all sums up to
      100.00%.
      
      So fix this by displaying the remaining hits that have been
      filtered but without more detail than their amount in each
      branches. Example while filtering below 50%:
      
      7.73%  [k] delay_tsc
                      |
                      |--98.22%-- __const_udelay
                      |          |
                      |          |--86.37%-- ath5k_hw_register_timeout
                      |          |          ath5k_hw_noise_floor_calibration
                      |          |          ath5k_hw_reset
                      |          |          ath5k_reset
                      |          |          ath5k_config
                      |          |          ieee80211_hw_config
                      |          |          |
                      |          |          |--88.53%-- ieee80211_scan_work
                      |          |          |          worker_thread
                      |          |          |          kthread
                      |          |          |          child_rip
                      |          |           --11.47%-- [...]
                      |           --13.63%-- [...]
                       --1.78%-- [...]
      
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1249690585-9145-4-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      25446036