Commit graph

349243 commits

Author SHA1 Message Date
Namhyung Kim 01d14f1615 perf report: Add --group option
Add --group option to enable event grouping.  When enabled, all the
group members information will be shown together with the leader.

  $ perf report --group
  ...
  # group: {ref-cycles,cycles}
  # ========
  #
  # Samples: 7K of event 'anon group { ref-cycles, cycles }'
  # Event count (approx.): 6876107743
  #
  #         Overhead  Command      Shared Object                      Symbol
  # ................  .......  .................  ..........................
  #
      99.84%  99.76%  noploop  noploop            [.] main
       0.07%   0.00%  noploop  ld-2.15.so         [.] strcmp
       0.03%   0.00%  noploop  [kernel.kallsyms]  [k] timerqueue_del
       0.03%   0.03%  noploop  [kernel.kallsyms]  [k] sched_clock_cpu
       0.02%   0.00%  noploop  [kernel.kallsyms]  [k] account_user_time
       0.01%   0.00%  noploop  [kernel.kallsyms]  [k] __alloc_pages_nodemask
       0.00%   0.00%  noploop  [kernel.kallsyms]  [k] native_write_msr_safe
       0.00%   0.11%  noploop  [kernel.kallsyms]  [k] _raw_spin_lock
       0.00%   0.06%  noploop  [kernel.kallsyms]  [k] find_get_page
       0.00%   0.02%  noploop  [kernel.kallsyms]  [k] rcu_check_callbacks
       0.00%   0.02%  noploop  [kernel.kallsyms]  [k] __current_kernel_time

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
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/1358845787-1350-18-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:49 -03:00
Namhyung Kim 717e263fc3 perf report: Show group description when event group is enabled
When using event group viewer, it's better to show the group description
rather than the leader information alone.

If a leader did not contain any member, it's a non-group event.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1358845787-1350-17-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:48 -03:00
Namhyung Kim fc24d7c25c perf report: Bypass non-leader events when event group is enabled
Since we have all necessary information in the leader events and other
members don't, bypass members.  Member events will be shown along with
the leaders if event group is enabled.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1358845787-1350-16-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:48 -03:00
Namhyung Kim 34b9564373 perf gtk/browser: Trim column header string when event group enabled
When event group feature is enabled, each column header is expanded to
match with the whole group column width.  But this is not needed for
GTK+ browser since ti usually use variable-width fonts.  So trim it.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1358845787-1350-15-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:48 -03:00
Namhyung Kim cb16008bcc perf gtk/browser: Add support for event group view
Show group members's overhead also when showing leader's if event
group is enabled.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranina@google.com>
Link: http://lkml.kernel.org/r/1358845787-1350-13-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:47 -03:00
Namhyung Kim 371d8c402e perf hists browser: Add suppport for event group view
Show group members' overhead also when showing the leader's if event
group is enabled.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
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/1358845787-1350-12-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:47 -03:00
Namhyung Kim 897014603c perf hists browser: Move coloring logic to hpp functions
Move coloring logic into the hpp functions so that each value can
be colored independently.  It'd required for event group view.

For overhead column, add a callback for printing 'folded_sign' of
callchains of a hist entry.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1358845787-1350-11-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:47 -03:00
Namhyung Kim 5b9e2146ec perf ui/hist: Add support for event group view
Show group member's overhead also when showing the leader's if event
group is enabled.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
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/1358845787-1350-10-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:46 -03:00
Namhyung Kim 843985e953 perf gtk/browser: Convert hpp helpers to a function
The hpp helpers do same job for each field so it was implemented as
macro in order to access those fields easily.  But it gets cumbersome to
maintain a large function in a macro as the function grows. Factor it
out to a function with a little helper macro to access field.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1358845787-1350-9-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:46 -03:00
Namhyung Kim 5aed9d2493 perf hists browser: Convert hpp helpers to a function
The hpp helpers do same job for each field so it was implemented as
macro in order to access those fields easily.  But it gets cumbersome
to maintain a large function in a macro as the function grows. Factor
it out to a function with a little helper macro to access field.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
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/1358845787-1350-8-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:46 -03:00
Namhyung Kim 4fb71074a5 perf ui/hist: Consolidate hpp helpers
Most of hpp helper functions do same jobs for different fields thus
consolidate them to appropriate functions/macros.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
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/1358845787-1350-7-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:45 -03:00
Namhyung Kim 29d720ed5f perf hists: Resort hist entries using group members for output
When event group is enabled, sorting hist entries on periods for output
should consider groups members' period also.  To do that, build period
table using link/pair information and compare the table.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
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/1358845787-1350-6-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:45 -03:00
Namhyung Kim 6e1f601a10 perf report: Make another loop for linking group hists
Now the event grouping viewing requires linking all member hists in a
group to the leader's.  Thus hists__output_resort should be called after
linking all events in evlist.

Introduce symbol_conf.event_group flag to determine whether the feature
is enabled or not.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
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/1358845787-1350-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:44 -03:00
Namhyung Kim a8bb559bd4 perf header: Add HEADER_GROUP_DESC feature
Save group relationship information so that it can be restored when perf
report is running.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
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/1358845787-1350-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:44 -03:00
Namhyung Kim 8d7d8474d7 perf tests: Add group test conditions
As some new fields for handling groups added, check them to be sure to
have valid values in test__group* cases.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
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/1358845787-1350-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:44 -03:00
Namhyung Kim 97f63e4a2c perf tools: Keep group information
Add a few of group-related field in struct perf_{evlist,evsel} so that
the group information in a evlist can be known easily.  It only counts
groups which have more than 1 members since leader-only groups are
treated as non-group events.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
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/1358845787-1350-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:43 -03:00
Arnaldo Carvalho de Melo 0de233b9c4 perf top: Delete maps on exit
Removing one more memory leak found with valgrind.

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@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/n/tip-gnb1gms0k8wictmtm2umpr8u@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:43 -03:00
Arnaldo Carvalho de Melo 11859e8217 perf top: Stop using exit()
Just return to the perf main() routine so that an unified exit path can
be followed and resources released, helping in finding memory leaks.

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@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/n/tip-ro8oeodo96490nrhcph57atr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 13:07:42 -03:00
Ingo Molnar 152fefa921 perf/core improvements and fixes:
. Fix some leaks in exit paths.
 
 . Use memdup where applicable
 
 . Remove some die() calls, allowing callers to handle exit paths
   gracefully.
 
 . Correct typo in tools Makefile, fix from Borislav Petkov.
 
 . Add 'perf bench numa mem' NUMA performance measurement suite, from Ingo Molnar.
 
 . Handle dynamic array's element size properly, fix from Jiri Olsa.
 
 . Fix memory leaks on evsel->counts, from Namhyung Kim.
 
 . Make numa benchmark optional, allowing the build in machines where required
   numa libraries are not present, fix from Peter Hurley.
 
 . Add interval printing in 'perf stat', from Stephane Eranian.
 
 . Fix compile warnings in tests/attr.c, from Sukadev Bhattiprolu.
 
 . Fix double free, pclose instead of fclose, leaks and double fclose errors
   found with the cppcheck tool, from Thomas Jarosch.
 
 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJRCSrdAAoJENZQFvNTUqpAa3oP/1+ehHEvk57zjEoFsv3B0WZ9
 6RuPUcK8XDYTTsp6WwG1AMfKGVjnZ9Pyv54Bd1UUBNtl3kBCQUuhQflxYMUk+BMo
 9rK1Qhl8IFG/M43xfHEdNnMo6OZCkiIaWEkJZxn5FLuhoyZZExe2HPbi+FJ2mfwT
 V1Sl914oWm9YmbL0rYMdCAV4KAbjvThdNBwmmP434CEDtiM6gcvPDU+2pepRQVDG
 79xwiXNv9Jg3QVIwypwICgYSkeSE4MmnynexnFUm7yayVoMUqXHFt7bZgmGt9xTI
 90qYnNOtVV4oWLUOMJG6vR4JwvphE1oqEfwdtkLBaIztLehgnUMRy3TDIz5K3sKS
 AR53Ba5OdWigtkYkUvY82Guk4TrErqbyGKLLnxXSEU/p1Ea6F7f5CfspHOCou03t
 S5TnYJeQkk00fvXxv7Wa+ubNZ7+WVJ3e0FjRB50AQDys/Nsj5puX6eQRHVKkBTdC
 dNZsK7b92C9mbwV7GHiqKRvjZvsrG4lSf388ysnH9YVIUQ/GoAVwQRwMfJI7HrXL
 n4OMbIjFXvexL53/gF2O/Xf4ce3xypU9G7BCfotW4dZzUNr2+fwzdlnxd7xbzkyb
 CV9m7k7hniYzopaE/TUGDZXQMizRHNC+voKAW7y1srEBLKDOnppjeC8/hFJcNeio
 tXFctJ+r5l2F3844F8+r
 =Jw9i
 -----END PGP SIGNATURE-----

Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

. Fix some leaks in exit paths.

. Use memdup where applicable

. Remove some die() calls, allowing callers to handle exit paths
  gracefully.

. Correct typo in tools Makefile, fix from Borislav Petkov.

. Add 'perf bench numa mem' NUMA performance measurement suite, from Ingo Molnar.

. Handle dynamic array's element size properly, fix from Jiri Olsa.

. Fix memory leaks on evsel->counts, from Namhyung Kim.

. Make numa benchmark optional, allowing the build in machines where required
  numa libraries are not present, fix from Peter Hurley.

. Add interval printing in 'perf stat', from Stephane Eranian.

. Fix compile warnings in tests/attr.c, from Sukadev Bhattiprolu.

. Fix double free, pclose instead of fclose, leaks and double fclose errors
  found with the cppcheck tool, from Thomas Jarosch.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-31 10:20:14 +01:00
Thomas Jarosch 5809fde040 perf header: Fix double fclose() on do_write(fd, xxx) failure
cppcheck reported:
[util/header.c:983]: (error) Used file that is not opened.

Thanks to Arnaldo Carvalho de Melo for pointing out that
fclose(NULL) is undefined behavior -> protect against it.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Link: http://lkml.kernel.org/r/1751778.SZQB4fNdIh@storm
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-30 10:40:44 -03:00
Thomas Jarosch fdae637391 perf header: Fix memory leak for the "Not caching a kptr_restrict'ed /proc/kallsyms" case
cppcheck reported:
[util/header.c:316]: (error) Memory leak: filename
[util/header.c:316]: (error) Memory leak: linkname

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Link: http://lkml.kernel.org/r/9377388.0eFDp53iW6@storm
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-30 10:40:18 -03:00
Thomas Jarosch 0b9e01a4f0 perf tools: Fix memory leak on error
cppcheck reported:
[util/event.c:480]: (error) Memory leak: event

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Link: http://lkml.kernel.org/r/2717013.8dV0naNhAV@storm
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-30 10:40:05 -03:00
Thomas Jarosch 8eb44dd76a perf sort: Use pclose() instead of fclose() on pipe stream
cppcheck message:
[tools/perf/util/sort.c:277]: (error) Mismatching allocation and deallocation: fp

Also fix descriptor leak on error and always initialize the "fp" variable.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Link: http://lkml.kernel.org/r/1359112354.yZcisNZ4k0@storm
Link: http://lkml.kernel.org/r/2266358.qvDXKLvJ67@storm
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-30 10:38:48 -03:00
Thomas Jarosch 68c465ada5 perf tools: Fix possible double free on error
Can only be triggered via CROSS_COMPILE env var.

Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Link: http://lkml.kernel.org/r/36736865.AIlztKhDqN@storm
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-30 10:37:41 -03:00
Sukadev Bhattiprolu e3541ec752 perf tools, powerpc: Fix compile warnings in tests/attr.c
We print several '__u64' quantities using '%llu'. On powerpc, we by
default include '<asm-generic/int-l64.h> which results in __u64 being an
unsigned long. This causes compile warnings which are treated as errors
due to '-Werror'.

By defining __SANE_USERSPACE_TYPES__ we include <asm-generic/int-ll64.h>
and define __u64 as unsigned long long.

Changelog[v2]:
	[Michael Ellerman] Use __SANE_USERSPACE_TYPES__ and avoid PRIu64
	format specifier - which as Jiri Olsa pointed out, breaks on x86-64.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Anton Blanchard <anton@au1.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Michael Ellerman <ellerman@au1.ibm.com>
Cc: linuxppc-dev@ozlabs.org
Link: http://lkml.kernel.org/r/20130124054439.GA31588@us.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-30 10:37:14 -03:00
Namhyung Kim 43f8e76e6b perf evsel: Fix memory leaks on evsel->counts
The ->counts field was never freed in the current code.  Add
perf_evsel__free_counts() function to free it properly.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@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/1359078284-32080-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-30 10:37:04 -03:00
Stephane Eranian 13370a9b5b perf stat: Add interval printing
This patch adds a new printing mode for perf stat.  It allows interval
printing. That means perf stat can now print event deltas at regular
time interval.  This is useful to detect phases in programs.

The -I option enables interval printing. It expects an interval duration
in milliseconds. Minimum is 100ms. Once, activated perf stat prints
events deltas since last printout. All modes are supported.

$ perf stat -I 1000 -e cycles noploop 10
noploop for 10 seconds
 #           time             counts events
      1.000109853      2,388,560,546 cycles
      2.000262846      2,393,332,358 cycles
      3.000354131      2,393,176,537 cycles
      4.000439503      2,393,203,790 cycles
      5.000527075      2,393,167,675 cycles
      6.000609052      2,393,203,670 cycles
      7.000691082      2,393,175,678 cycles

The output format makes it easy to feed into a plotting program such as
gnuplot when the -I option is used in combination with the -x option:

$ perf stat -x, -I 1000 -e cycles noploop 10
noploop for 10 seconds
1.000084113,2378775498,cycles
2.000245798,2391056897,cycles
3.000354445,2392089414,cycles
4.000459115,2390936603,cycles
5.000565341,2392108173,cycles

Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1359460064-3060-3-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-30 10:36:53 -03:00
Stephane Eranian c7a79c47c6 perf evsel: Add prev_raw_count field
This field will be used by commands which print counter deltas on
regular timer intervals, such as perf stat -I.

Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1359460064-3060-2-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-30 10:36:38 -03:00
Peter Hurley 79d824e316 perf tools: Make numa benchmark optional
Commit "perf: Add 'perf bench numa mem'..." added a NUMA performance
benchmark to perf. Make this optional and test for required
dependencies.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1359337882-21821-1-git-send-email-peter@hurleysoftware.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-30 10:36:21 -03:00
Ingo Molnar 1c13f3c904 perf: Add 'perf bench numa mem' NUMA performance measurement suite
Add a suite of NUMA performance benchmarks.

The goal was simulate the behavior and access patterns of real NUMA
workloads, via a wide range of parameters, so this tool goes well
beyond simple bzero() measurements that most NUMA micro-benchmarks use:

 - It processes the data and creates a chain of data dependencies,
   like a real workload would. Neither the compiler, nor the
   kernel (via KSM and other optimizations) nor the CPU can
   eliminate parts of the workload.

 - It randomizes the initial state and also randomizes the target
   addresses of the processing - it's not a simple forward scan
   of addresses.

 - It provides flexible options to set process, thread and memory
   relationship information: -G sets "global" memory shared between
   all test processes, -P sets "process" memory shared by all
   threads of a process and -T sets "thread" private memory.

 - There's a NUMA convergence monitoring and convergence latency
   measurement option via -c and -m.

 - Micro-sleeps and synchronization can be injected to provoke lock
   contention and scheduling, via the -u and -S options. This simulates
   IO and contention.

 - The -x option instructs the workload to 'perturb' itself artificially
   every N seconds, by moving to the first and last CPU of the system
   periodically. This way the stability of convergence equilibrium and
   the number of steps taken for the scheduler to reach equilibrium again
   can be measured.

 - The amount of work can be specified via the -l loop count, and/or
   via a -s seconds-timeout value.

 - CPU and node memory binding options, to test hard binding scenarios.
   THP can be turned on and off via madvise() calls.

 - Live reporting of convergence progress in an 'at glance' output format.
   Printing of convergence and deconvergence events.

The 'perf bench numa mem -a' option will start an array of about 30
individual tests that will each output such measurements:

 # Running  5x5-bw-thread, "perf bench numa mem -p 5 -t 5 -P 512 -s 20 -zZ0q --thp  1"
  5x5-bw-thread,                         20.276, secs,           runtime-max/thread
  5x5-bw-thread,                         20.004, secs,           runtime-min/thread
  5x5-bw-thread,                         20.155, secs,           runtime-avg/thread
  5x5-bw-thread,                          0.671, %,              spread-runtime/thread
  5x5-bw-thread,                         21.153, GB,             data/thread
  5x5-bw-thread,                        528.818, GB,             data-total
  5x5-bw-thread,                          0.959, nsecs,          runtime/byte/thread
  5x5-bw-thread,                          1.043, GB/sec,         thread-speed
  5x5-bw-thread,                         26.081, GB/sec,         total-speed

See the help text and the code for more details.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2013-01-30 10:35:36 -03:00
Borislav Petkov 7e010562e0 tools: Correct typo in tools Makefile
It should be

make -C tools/ <tool>_install

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/1359456492-22156-1-git-send-email-bp@alien8.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-30 10:35:14 -03:00
Arnaldo Carvalho de Melo ec13abc37f perf tests: Fix leaks on PERF_RECORD_* test
This test:

 7: Validate PERF_RECORD_* events & perf_sample fields

needs to call perf_evlist__delete_maps().

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@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/n/tip-t3181qy15avffdacqjcxfku2@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-30 10:35:02 -03:00
Arnaldo Carvalho de Melo c0aab59f67 perf tests: Call machine__exit in the vmlinux matches kallsyms test
Removing leaks with valgrind.

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@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/n/tip-x9hja7wxwexe8ca9v2j8qtlg@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-25 12:49:29 -03:00
Arnaldo Carvalho de Melo 56ab714032 perf ui browser: Free browser->helpline() on ui_browser__hide()
It is allocated at ui_browser__show(), so free it in its counterpart,
ui_browser__hide().

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@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/n/tip-g449kvnbcpli4ceyxbe2jp1e@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-25 12:49:29 -03:00
Arnaldo Carvalho de Melo 2caa48a240 perf header: Stop using die() calls when processing tracing data
The callers of this function (perf_event__process_tracing_data) already
handles a negative value return as error, so just use pr_err() to log
the problem and return -1 instead of panic'ing.

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@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/n/tip-eeeljnecpi0zi5s7ux1mzdv9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-25 12:49:29 -03:00
Arnaldo Carvalho de Melo 8d9233f205 perf kmem: Use memdup()
Instead of hand coded equivalent.

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@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/n/tip-42ldngi973f4ssvzlklo8t2k@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-25 12:49:28 -03:00
Arnaldo Carvalho de Melo 8e16017d49 perf tools: Use memdup in map__clone
We have memdup() exactly for that, remove open coded dup.

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@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/n/tip-tnsoexrgv6u9l125srq2c7su@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-25 12:49:28 -03:00
Arnaldo Carvalho de Melo 237a7e04a1 perf tools: Stop using 'self' in map.[ch]
As suggested by tglx, 'self' should be replaced by something that is
more useful.

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@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/n/tip-vse2c54m0yahx6p79tmoel03@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-25 12:49:28 -03:00
Arnaldo Carvalho de Melo d8639f068a perf tools: Stop using 'self' in strlist
As suggested by tglx, 'self' should be replaced by something that is
more useful.

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@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/n/tip-933537sxtcz47qs0e0ledmrp@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-25 12:49:28 -03:00
Jiri Olsa e23c1a5578 tools lib traceevent: Handle dynamic array's element size properly
Fixing the dynamic array format field parsing.

Currently the event_read_fields function could segfault while parsing
dynamic array other than string type. The reason is the event->pevent
does not need to be set and gets dereferenced unconditionaly.

Also adding proper initialization of field->elementsize based on the
parsed dynamic type.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1359060403-32422-1-git-send-email-jolsa@redhat.com
[ committer note: Made a char pointer parameter const, as requested by Steven ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-25 12:49:28 -03:00
Ingo Molnar a2d28d0c19 perf/core improvements and fixes
. Allow skipping problematic entries in 'perf test'.
 
 . Fix some namespace problems in the event parsing routines.
 
 . Add 'perf test' entry to make sure the python binding doesn't have
   linking problems.
 
 . Adjust 'perf test' attr tests verbosity levels.
 
 . Make tools/perf build with GNU make v3.80, fix from Al Cooper.
 
 . Do missing feature fallbacks in just one place, removing duplicated
   code in multiple tools.
 
 . Fix some memory leaks, from David Ahern.
 
 . Fix segfault when drawing out-of-bounds jumps, from Frederik Deweerdt.
 
 . Allow of casting an array of char to string in 'perf probe', from
   Hyeoncheol Lee.
 
 . Add support for wildcard in tracepoint system name, from Jiri Olsa.
 
 . Update FSF postal address to be URL's, from Jon Stanley.
 
 . Add anonymous huge page recognition, from Joshua Zhu.
 
 . Remove some needless feature test checks, from Namhyung Kim.
 
 . Multiple improvements to the sort routines, from Namhyung Kim.
 
 . Fix warning on '>=' operator in libtraceevent, from Namhyung Kim.
 
 . Use ARRAY_SIZE instead of reinventing it in 'perf script' and 'perf kmem',
   from Sasha Levin.
 
 . Remove some redundant checks, from Sasha Levin.
 
 . Test correct variable after allocation in libtraceevent, fix from Sasha Levin.
 
 . Mark branch_info maps as referenced, fix from Stephane Eranian.
 
 . Fix PMU format parsing test failure, from Sukadev Bhattiprolu.
 
 . Fix possible (unlikely) buffer overflow, from Thomas Jarosch.
 
 . Multiple 'perf script' fixes, from Tom Zanussi.
 
 . Add missing field in PERF_RECORD_SAMPLE documentation, from Vince Weaver.
 
 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJRAZIRAAoJENZQFvNTUqpAA6AP+wTFrshPRkrjMcySBxYa5qdS
 Dg+2VujN4Ticz+SsPhqLNN/uISuq3I1B2BuLQ6UHxioIDnA2BIWmoOm1ijPspmyZ
 fdT/AyyiyYoV2V7N7X3HORrtnYMP/2RCccotJOL16YY2XyL1W/rcKohxZipcHL19
 j3DtlqHAWcu8u/b7powrMB/JiVO5msGUn+aOm1E7jUC41H7vixKAFAPk1ERRz3+/
 dPMskpTLR1UsuEbyt5BwOY1XHPurkNCDJJvTeO7gEc++pLcIARJjhgtOCKdAa9ak
 IOJl343i5/fXWwep0bUOEYbpi5WVhYBEp+7m3jOe9Fj4nMQppXNha894SegIQA3H
 c9H2sGgNyrlgrhHdfCrBrFhC8wfHZZoUJ5HQP0Jyqn3tszMpWK+XUp650QYaavGx
 k3AEiYA2SFTdx2WUy6IYse44VyDkDaAQanTocbUiD0M+2alvop0yhjVp0QW3s4Ne
 65frbUS6MaMTWlYf8OiazFMZMc0pz3zr3RQgN23nAG2+nDpURrtIO6zLXEV02rV3
 FEvDFFgzg8NZLvk8LqaV9hpDRUUSfsK2dhrimPZgh26XHGx1tn1dlfxNgpFl+d1J
 iW0LPkB7st8wmQdIvtaFUGfjGtEgELKiH7xPU5k4RzALVK8xajdPzPffYbvCKlaZ
 ag9GjAe+x93Hd4umJtOH
 =FJ2l
 -----END PGP SIGNATURE-----

Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

. Allow skipping problematic entries in 'perf test'.

. Fix some namespace problems in the event parsing routines.

. Add 'perf test' entry to make sure the python binding doesn't have
  linking problems.

. Adjust 'perf test' attr tests verbosity levels.

. Make tools/perf build with GNU make v3.80, fix from Al Cooper.

. Do missing feature fallbacks in just one place, removing duplicated
  code in multiple tools.

. Fix some memory leaks, from David Ahern.

. Fix segfault when drawing out-of-bounds jumps, from Frederik Deweerdt.

. Allow of casting an array of char to string in 'perf probe', from
  Hyeoncheol Lee.

. Add support for wildcard in tracepoint system name, from Jiri Olsa.

. Update FSF postal address to be URL's, from Jon Stanley.

. Add anonymous huge page recognition, from Joshua Zhu.

. Remove some needless feature test checks, from Namhyung Kim.

. Multiple improvements to the sort routines, from Namhyung Kim.

. Fix warning on '>=' operator in libtraceevent, from Namhyung Kim.

. Use ARRAY_SIZE instead of reinventing it in 'perf script' and 'perf kmem',
  from Sasha Levin.

. Remove some redundant checks, from Sasha Levin.

. Test correct variable after allocation in libtraceevent, fix from Sasha Levin.

. Mark branch_info maps as referenced, fix from Stephane Eranian.

. Fix PMU format parsing test failure, from Sukadev Bhattiprolu.

. Fix possible (unlikely) buffer overflow, from Thomas Jarosch.

. Multiple 'perf script' fixes, from Tom Zanussi.

. Add missing field in PERF_RECORD_SAMPLE documentation, from Vince Weaver.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2013-01-25 11:34:00 +01:00
Arnaldo Carvalho de Melo 2ae828786c perf test: Allow skipping tests
Sometimes a test is problematic for some reason and one wants to skip it,
for instance:

[root@sandy ~]# perf test
   1: vmlinux symtab matches kallsyms                        : Ok
   2: detect open syscall event                              : Ok
   3: detect open syscall event on all cpus                  : Ok
   4: read samples using the mmap interface                  : Ok
   5: parse events tests                                     :  Warning: bad op token {
    Warning: bad op token {
    Warning: bad op token {
    Warning: bad op token {
    Warning: bad op token {
    Warning: function is_writable_pte not defined
  Segmentation fault (core dumped)

So now we can use -s/--skip while the problematic tests are being fixed,
allowing us to test all the other entries:

  [root@sandy ~]# perf test -s 5
   1: vmlinux symtab matches kallsyms                        : Ok
   2: detect open syscall event                              : Ok
   3: detect open syscall event on all cpus                  : Ok
   4: read samples using the mmap interface                  : Ok
   5: parse events tests                                     : Skip (user override)
   6: x86 rdpmc test                                         : Ok
   7: Validate PERF_RECORD_* events & perf_sample fields     : Ok
   8: Test perf pmu format parsing                           : Ok
   9: Test dso data interface                                : Ok
  10: roundtrip evsel->name check                            : Ok
  11: Check parsing of sched tracepoints fields              : Ok
  12: Generate and check syscalls:sys_enter_open event fields: Ok
  13: struct perf_event_attr setup                           : Ok
  14: Test matching and linking mutliple hists               : Ok
  15: Try 'use perf' in python, checking link problems       : Ok
  [root@sandy ~]#

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@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/n/tip-klzd8p57jzdryafqkmlppcb1@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-24 16:40:53 -03:00
Arnaldo Carvalho de Melo ffe0fb769a perf tools: Allow passing a list to intlist__new
Just like strlist allows passing a list of entries to parse.

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@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/n/tip-em50vqvvmlnc6k9tw4xtixus@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-24 16:40:53 -03:00
Arnaldo Carvalho de Melo 5a3d04d6dc perf tools: Allow passing NULL to intlist__find
So that we can work with optional parameters that may not set up an
intlist.

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@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/n/tip-e9tmvgdzehqrza11zs0nbg7g@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-24 16:40:53 -03:00
Tom Zanussi 1de7b7e89d perf script: Remove workqueue-stats script
The tracepoints used by the workqueue-stats script no longer exist so
trying to run the script results in:

  # perf script record workqueue-stats
  invalid or unsupported event: 'workqueue:workqueue_creation'
  Run 'perf list' for a list of valid events

So remove the script until it can be reworked using the new workqueue
tracepoints.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Link: http://lkml.kernel.org/r/e7a7637d5df9df86887c3bff7683574665ec5360.1358527965.git.tom.zanussi@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-24 16:40:53 -03:00
Tom Zanussi 2de9533d6d perf script: hook up perf_scripting_context->pevent
Running the check-perf-trace scripts causes segfaults in both the Perl
and Python cases:

  # perf script record check-perf-trace
  # perf script -s libexec/perf-core/scripts/python/check-perf-trace.py
  trace_begin
  Segmentation fault (core dumped)

The reason is that the 'pevent' field was added to
perf_scripting_context but it wasn't hooked up with an actual pevent in
either case, so when one of the 'common' fields is accessed (in
util/trace-event-parse.c:get_common_fields()), pevent->events tries to
dereference a NULL pointer.

This sets the pevent field when the scripting context is set up.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Link: http://lkml.kernel.org/r/d2b1b8166a6ca0a36e1f5255b88a8289058ba236.1358527965.git.tom.zanussi@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-24 16:40:52 -03:00
Tom Zanussi bdb71db29d perf script: Don't display trace info when invoking scripts
Only display the trace info if using the default event display.  When
invoking scripts we assume they have complete control of what's
displayed so we shouldn't unconditionally display the trace info, and
when generating scripts we don't expect to see trace info obscuring the
output message.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Link: http://lkml.kernel.org/r/12ec084ef2870178915c907d16cd1dfa19fbb39e.1358527965.git.tom.zanussi@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-24 16:40:52 -03:00
Tom Zanussi 10ee9fa3b9 perf tools: Reinstate 'signed' field flag for tracepoints
For some reason the libtraceevent tracepoint-parsing code is missing
the FIELD_IS_SIGNED flag-setting code, which causes problems for the
Perl trace event binding at least, since it ends up unable to
recognize negative numbers.

Things like checking for negative return values therefore fail, causing
scripts like rwtop to instead interpret the negative return value as a
large positive value, which in turn get added to e.g. read totals with
insanely invalid results.

So set the FIELD_IS_SIGNED flag for tracepoint events that specify
"signed:1".

Before:

  # perf script record rw-by-pid
  # perf script report rw-by-pid

  read counts by pid:

     pid                  comm     # reads  bytes_requested  bytes_read
  ------  --------------------  -----------  ----------  ----------
     753  Xorg                          88      512000  7.74763251095801e+20
    1619  firefox                       42         462  2.58254417031934e+20
    1232  gnome-shell                   11         176  1.10680464442257e+20
    1471  gnome-terminal                 3       16366  18446744073709551615
    1408  libsocialweb-co                2          32  18446744073709551613

After:

  # perf script report rw-by-pid

  read counts by pid:

     pid                  comm     # reads  bytes_requested  bytes_read
  ------  --------------------  -----------  ----------  ----------
     753  Xorg                          88      512000        2764
    1619  firefox                       42         462         126
    1232  gnome-shell                   11         176          40
    1471  gnome-terminal                 3       16366          10
    1408  libsocialweb-co                2          32           8

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Link: http://lkml.kernel.org/r/1471b5968821a455cf5168bb4567964e74ecf530.1358527965.git.tom.zanussi@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-24 16:40:52 -03:00
Arnaldo Carvalho de Melo 2a16bf8c13 perf tools: Remove some needless die() calls from the main routine
Some would just call exit() anyway right after calling die() and the
main routine doesn't have to call it, just return the exit value.

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@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/n/tip-nzq0sdur6oq6lgkt2ipf4o8s@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-24 16:40:52 -03:00
Arnaldo Carvalho de Melo ab1bf65322 perf pmu: Privatize perf_pmu_{format,alias} structs
They are only used in pmu.c, so no need to make them public in pmu.h.

Acked-by: Jiri Olsa <jolsa@redhat.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@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/n/tip-3gu6vhyro22ywqcldy0gtegv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-24 16:40:51 -03:00