1. 10 Nov, 2010 11 commits
    • Peter Zijlstra's avatar
      perf, amd: Use kmalloc_node(,__GFP_ZERO) for northbridge structure allocation · 034c6efa
      Peter Zijlstra authored
      Jasper suggested we use the zeroing capability of the allocators
      instead of calling memset ourselves. Add node affinity while we're at
      it.
      Reported-by: default avatarJesper Juhl <jj@chaosbits.net>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      034c6efa
    • Stephane Eranian's avatar
      perf_events: Fix time tracking in samples · eed01528
      Stephane Eranian authored
      This patch corrects time tracking in samples. Without this patch
      both time_enabled and time_running are bogus when user asks for
      PERF_SAMPLE_READ.
      
      One uses PERF_SAMPLE_READ to sample the values of other counters
      in each sample. Because of multiplexing, it is necessary to know
      both time_enabled, time_running to be able to scale counts correctly.
      
      In this second version of the patch, we maintain a shadow
      copy of ctx->time which allows us to compute ctx->time without
      calling update_context_time() from NMI context. We avoid the
      issue that update_context_time() must always be called with
      ctx->lock held.
      
      We do not keep shadow copies of the other event timings
      because if the lead event is overflowing then it is active
      and thus it's been scheduled in via event_sched_in() in
      which case neither tstamp_stopped, tstamp_running can be modified.
      
      This timing logic only applies to samples when PERF_SAMPLE_READ
      is used.
      
      Note that this patch does not address timing issues related
      to sampling inheritance between tasks. This will be addressed
      in a future patch.
      
      With this patch, the libpfm4 example task_smpl now reports
      correct counts (shown on 2.4GHz Core 2):
      
      $ task_smpl -p 2400000000 -e unhalted_core_cycles:u,instructions_retired:u,baclears  noploop 5
      noploop for 5 seconds
      IIP:0x000000004006d6 PID:5596 TID:5596 TIME:466,210,211,430 STREAM_ID:33 PERIOD:2,400,000,000 ENA=1,010,157,814 RUN=1,010,157,814 NR=3
      	2,400,000,254 unhalted_core_cycles:u (33)
      	2,399,273,744 instructions_retired:u (34)
      	53,340 baclears (35)
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <4cc6e14b.1e07e30a.256e.5190@mx.google.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      eed01528
    • Tom Zanussi's avatar
      perf trace: update usage · 7e55055e
      Tom Zanussi authored
      Update usage to reflect the different perf trace variants.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      7e55055e
    • Tom Zanussi's avatar
      perf trace: update Documentation with new perf trace variants · d3c4f798
      Tom Zanussi authored
      Add documentation describing new 'perf trace' command changes
      e.g. <command> handling and live-mode/top variants.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      d3c4f798
    • Tom Zanussi's avatar
      perf trace: live-mode command-line cleanup · b5b87312
      Tom Zanussi authored
      This patch attempts to make the perf trace command-line for live-mode
      commands more user-friendly and consistent with other perf commands.
      
      The main change it makes is to allow <commands> to be run as part of
      perf trace live-mode commands, as other perf commands do, instead of
      the system-wide traces they're currently hard-coded to by the shell
      scripts.
      
      With this patch, the following live-mode trace now works as expected:
      
       $ perf trace rw-by-pid ls -al
      
      The previous system-wide behavior for this command would still be
      available by explicitly specifying -a:
      
       $ perf trace rw-by-pid -a ls -al
      
      and if no <command> is specified, the output is also system-wide:
      
       $ perf trace rw-by-pid
      
      Because live-mode requires both record and report steps to be invoked,
      it isn't always possible to know which args to send to the report and
      which to send to the record steps - mainly this is the case for report
      scripts with optional args - in those cases it would be necessary to
      use separate 'perf trace record' and 'perf trace report' steps.
      
      For example:
      
       $ perf trace syscall-counts ls
      
      Here we can't decide whether ls should be passed as a param to the
      syscall-counts script or whether we should invoke ls as a <command>.
      In these cases, we just say that we'll ignore optional script params
      and always interpret the extra arguments as a <command>.
      
      If the user instead wants the other interpretation, that can be
      accomplished by using separate record and report commands explicitly:
      
       $ perf trace record syscall-counts
       $ perf trace report syscall-counts ls
      
      So the rules that this patch implements, which seem to make the most
      intuitive sense for live-mode commands:
      
      - for commands with optional args and commands with no args, no args
        are sent to the report script, all are sent to the record step
      
      - for 'top' commands i.e. that end with 'top', <commands> can't be
        used - all extra args are send to the report script as params
      
      - for commands with required args, the n required args are taken to be
        the first n args after the script name and sent to the report
        script, and the rest are sent to the record step
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      b5b87312
    • Tom Zanussi's avatar
      perf trace record: handle commands correctly · 34c86ea9
      Tom Zanussi authored
      Because the perf-trace shell scripts hard-coded the use of the
      perf-record system-wide param, a perf trace record session was always
      system wide, even if it was given a command.
      
      If given a command, perf trace record now only records the events for
      the command, as users expect.
      
      If no command is given, or if the '-a' option is used, the recorded
      events are system-wide, as before.
      
      root@tropicana:~# perf trace record syscall-counts ls -al
      root@tropicana:~# perf trace
                    ls-23152 [000] 39984.890387: sys_enter: NR 12 (0, 0, 0, 0, 0, 0)
                    ls-23152 [000] 39984.890404: sys_enter: NR 9 (0, 0, 0, 0, 0, 0)
      
      root@tropicana:~# perf trace record syscall-counts -a ls -al
      root@tropicana:~# perf trace
          npviewer.bin-22297 [000] 39831.102709: sys_enter: NR 168 (0, 0, 0, 0, 0, 0)
                    ls-23111 [000] 39831.107679: sys_enter: NR 59 (0, 0, 0, 0, 0, 0)
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      34c86ea9
    • Tom Zanussi's avatar
      perf record: make the record options available outside perf record · bca647aa
      Tom Zanussi authored
      Other perf commands that invoke perf record, such as perf trace, may
      want to reuse the options used by perf record.
      
      This makes them non-static and renames them to avoid clashes with
      other 'options' variables.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      bca647aa
    • Tom Zanussi's avatar
      perf trace scripting: remove system-wide param from shell scripts · b0b6d914
      Tom Zanussi authored
      Including -a unconditionally when recording doesn't allow for the
      option of running scripts without it.  Future patches will add add it
      back if needed at run-time.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      b0b6d914
    • Tom Zanussi's avatar
      perf trace scripting: fix some small memory leaks and missing error checks · e8719adf
      Tom Zanussi authored
      Free the other two fields of script_desc which somehow got overlooked,
      free malloc'ed args in case exec fails, and add missing checks for
      failed mallocs.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      e8719adf
    • Corey Ashford's avatar
      perf: Fix usages of profile_cpu in builtin-top.c to use cpu_list · 01797c59
      Corey Ashford authored
      profile_cpu was left over from an earlier implementation that
      supported running perf top on a single CPU.  profile_cpu was no
      longer set by any switch and usages of it resulted in dead code.
      
      Instead, convert the code to use cpu_list, which is set by the
      -C <cpu_list> option.
      
      Also improved the printing of nr_cpus and cpu_list by correcting
      the plurals.
      Signed-off-by: default avatarCorey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: a.p.zijlstra@chello.nl
      Cc: acme@redhat.com
      LKML-Reference: <1289269245-9388-1-git-send-email-cjashfor@linux.vnet.ibm.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      01797c59
    • Cyrill Gorcunov's avatar
      perf, ui: Eliminate stack-smashing protection compiler complaint · a3da8e45
      Cyrill Gorcunov authored
      The gcc complains about small auto-var strings being allocated from stack space.
      Make them const to avoid this:
      
       | CC util/ui/util.o
       | cc1: warnings being treated as errors
       | util/ui/util.c: In function ‘ui__dialog_yesno’:
       | util/ui/util.c:108: error: not protecting function: no buffer at least 8 bytes long
       | make: *** [util/ui/util.o] Error 1
      
      The real bug is in the newtWinChoice() ABI - but that's an
      externality we cannot fix here, so we use this workaround.
      Signed-off-by: default avatarCyrill Gorcunov <gorcunov@openvz.org>
      Acked-by: default avatarFrédéric Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20101106084724.GA5956@lenovo>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a3da8e45
  2. 09 Nov, 2010 5 commits
  3. 08 Nov, 2010 17 commits
  4. 06 Nov, 2010 7 commits