Namhyung Kim
26d8b33827
perf tools: Consolidate output field handling to hpp format routines
...
Until now the hpp and sort functions do similar jobs different ways.
Since the sort functions converted/wrapped to hpp formats it can do
the job in a uniform way.
The perf_hpp__sort_list has a list of hpp formats to sort entries and
the perf_hpp__list has a list of hpp formats to print output result.
To have a backward compatibility, it automatically adds 'overhead'
field in front of sort list. And then all of fields in sort list
added to the output list (if it's not already there).
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Ingo Molnar <mingo@kernel.org >
Link: http://lkml.kernel.org/n/tip-7g3h86woz2sckg3h1lj42ygj@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-21 11:45:34 +02:00
Namhyung Kim
043ca389a3
perf tools: Use hpp formats to sort final output
...
Convert output sorting function to use ->sort hpp functions.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Ingo Molnar <mingo@kernel.org >
Link: http://lkml.kernel.org/r/1400480762-22852-6-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-21 11:45:34 +02:00
Namhyung Kim
f156d84e42
perf tools: Support event grouping in hpp ->sort()
...
Move logic of hist_entry__sort_on_period to __hpp__sort() in order to
support event group report.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Ingo Molnar <mingo@kernel.org >
Link: http://lkml.kernel.org/r/1400480762-22852-5-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-21 11:45:34 +02:00
Namhyung Kim
093f0ef34c
perf tools: Use hpp formats to sort hist entries
...
It wrapped sort entries to hpp functions, so using the hpp sort list
to sort entries.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Ingo Molnar <mingo@kernel.org >
Link: http://lkml.kernel.org/r/1400480762-22852-4-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-21 11:45:34 +02:00
Namhyung Kim
8b536999cd
perf tools: Convert sort entries to hpp formats
...
This is a preparation of consolidating management of output field and
sort keys.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Ingo Molnar <mingo@kernel.org >
Link: http://lkml.kernel.org/r/1400480762-22852-3-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-21 11:45:34 +02:00
Namhyung Kim
bc18b7f2e3
perf tools: Add ->cmp(), ->collapse() and ->sort() to perf_hpp_fmt
...
Those function pointers will be used to sort report output based on
the selected fields. This is a preparation of later change.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Ingo Molnar <mingo@kernel.org >
Link: http://lkml.kernel.org/r/1400480762-22852-2-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-21 11:45:33 +02:00
Jean Pihet
97eac381b1
perf tools: Add libdw DWARF post unwind support for ARM
...
Adding libdw DWARF post unwind support, which is part
of elfutils-devel/libdw-dev package from version 0.158.
The new code is contained in unwin-libdw.c object, and
implements unwind__get_entries unwind interface function.
Signed-off-by: Jean Pihet <jean.pihet@linaro.org >
Reviewed-by: Will Deacon <will.deacon@arm.com >
Cc: Arnaldo Carvalho de Melo <acme@kernel.org >
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1400229672-16104-4-git-send-email-jean.pihet@linaro.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-16 11:39:29 +02:00
Jean Pihet
90fa9deb32
perf tests: Add dwarf unwind test on ARM
...
Adding dwarf unwind test, that setups live machine data over
the perf test thread and does the remote unwind.
Need to use -fno-optimize-sibling-calls for test compilation,
otherwise 'krava_*' function calls are optimized into jumps
and omitted from the stack unwind.
So far it was enabled only for x86.
Signed-off-by: Jean Pihet <jean.pihet@linaro.org >
Reviewed-by: Will Deacon <will.deacon@arm.com >
Cc: Arnaldo Carvalho de Melo <acme@kernel.org >
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1400229672-16104-3-git-send-email-jean.pihet@linaro.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-16 11:39:18 +02:00
Jean Pihet
3418f9667e
perf tests: Introduce perf_regs_load function on ARM
...
Introducing perf_regs_load function, which is going
to be used for dwarf unwind test in following patches.
It takes single argument as a pointer to the regs dump
buffer and populates it with current registers values.
Signed-off-by: Jean Pihet <jean.pihet@linaro.org >
Reviewed-by: Will Deacon <will.deacon@arm.com >
Cc: Arnaldo Carvalho de Melo <acme@kernel.org >
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1400229672-16104-2-git-send-email-jean.pihet@linaro.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-16 11:39:05 +02:00
Jean Pihet
21a8b756b8
perf tools: Consolidate types.h for ARM and ARM64
...
Prevents a build breakage since commit d944c4eebc
'tools: Consolidate types.h'
Signed-off-by: Jean Pihet <jean.pihet@linaro.org >
Link: http://lkml.kernel.org/r/1400229672-16104-1-git-send-email-jean.pihet@linaro.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-16 11:38:57 +02:00
Masanari Iida
c5765ece8a
perf session: Fix possible null pointer dereference in session.c
...
cppcheck detected following warning:
[tools/perf/util/session.c:1628] -> [tools/perf/util/session.c:1632]:
(warning) Possible null pointer dereference: session - otherwise it
is redundant to check it against null.
In order to avoide null pointer, check the pointer before use.
Signed-off-by: Masanari Iida <standby24x7@gmail.com >
Link: http://lkml.kernel.org/r/1400087618-13628-1-git-send-email-standby24x7@gmail.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-16 09:18:51 +02:00
Dongsheng Yang
9d372ca59b
perf sched: Cleanup, remove unused variables in map_switch_event()
...
In map_switch_event(), we don't care the previous process currently,
this patch remove the infomation we get but not used.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com >
Link: http://lkml.kernel.org/r/1400218625-14613-1-git-send-email-yangds.fnst@cn.fujitsu.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-16 09:17:50 +02:00
Dongsheng Yang
67d6259dd0
perf sched: Remove nr_state_machine_bugs in perf latency
...
As we do not use .success in sched_wakeup event any more, then
we can not guarantee that the task when wakeup event happen is
out of run queue. So the message of nr_state_machine_bugs is
not correct.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com >
Link: http://lkml.kernel.org/r/1399945101-21736-1-git-send-email-yangds.fnst@cn.fujitsu.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-16 09:17:36 +02:00
Peter Zijlstra
0680ee7db1
perf tools: Remove usage of trace_sched_wakeup(.success)
...
trace_sched_wakeup(.success) is a dead argument and has been for ages,
the only reason its still there is because of brain dead software, which
apparently includes perf tools
There's a few more instances in pearly snake shit, but that's not
supported as far as I care anyhow, so let that bitrot.
Signed-off-by: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20140512181946.GG13467@laptop.programming.kicks-ass.net
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-12 21:13:44 +02:00
Namhyung Kim
13ce34df11
perf tools: Use tid for finding thread
...
I believe that passing pid (instead of tid) as the 3rd arg of the
machine__find*_thread() was to find a main thread so that it can
search proper map group for symbols. However with the map sharing
patch applied, it now can do it in any thread.
It fixes a bug when each thread has different name, it only reports a
main thread for samples in other threads.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: David Ahern <dsahern@gmail.com >
Acked-by: Stephane Eranian <eranian@google.com >
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Link: http://lkml.kernel.org/r/1399856202-26221-1-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-12 11:09:50 +02:00
Namhyung Kim
bac1e4d103
perf tools: Get rid of on_exit() feature test
...
The on_exit() function was only used in perf record but it's gone in
previous patch.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Stephane Eranian <eranian@google.com >
Cc: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org >
Cc: Irina Tirdea <irina.tirdea@intel.com >
Link: http://lkml.kernel.org/r/1399855645-25815-2-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-12 11:09:50 +02:00
Namhyung Kim
4560471053
perf record: Propagate exit status of a command line workload
...
Currently perf record doesn't propagate the exit status of a workload
given by the command line. But sometimes it'd useful if it's
propagated so that a monitoring script can handle errors
appropriately.
To do that, it moves most of logic out of the exit handlers and run
them directly in the __cmd_record(). The only thing needs to be done
in the handler is propagating terminating signal so that the shell can
terminate its loop properly when Ctrl-C was pressed. Also it cleaned
up the resource management code in record__exit().
With this change, perf record returns the child exit status in case of
normal termination and send signal to itself when terminated by signal.
Example run of Stephane's case:
$ perf record true && echo yes || echo no
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.013 MB perf.data (~589 samples) ]
yes
$ perf record false && echo yes || echo no
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.013 MB perf.data (~589 samples) ]
no
Jiri's case (error in parent):
$ perf record -m 10G true && echo yes || echo no
rounding mmap pages size to 17179869184 bytes (4194304 pages)
failed to mmap with 12 (Cannot allocate memory)
no
$ ulimit -n 6
$ perf record sleep 1 && echo yes || echo no
failed to create 'go' pipe: Too many open files
Couldn't run the workload!
no
And Peter's case (interrupted by signal):
$ while :; do perf record sleep 1; done
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.014 MB perf.data (~593 samples) ]
Reported-by: Stephane Eranian <eranian@google.com >
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Stephane Eranian <eranian@google.com >
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl >
Acked-by: Ingo Molnar <mingo@kernel.org >
Link: http://lkml.kernel.org/r/1399855645-25815-1-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-12 11:09:49 +02:00
Dongsheng
6bcab4e1ea
perf tools: Clarify the output of perf sched map.
...
In output of perf sched map, any shortname of thread will be explained
at the first time when it appear.
Example:
*A0 228836.978985 secs A0 => perf:23032
*. A0 228836.979016 secs B0 => swapper:0
. *C0 228836.979099 secs C0 => migration/3:22
*A0 . C0 228836.979115 secs
A0 . *. 228836.979115 secs
But B0, which is explained as swapper:0 did not appear in the
left part of output. Instead, we use '.' as the shortname of
swapper:0. So the comment of "B0 => swapper:0" is not easy to
understand.
This patch clarify the output of perf sched map with not allocating
one letter-number shortname for swapper:0 and print ". => swapper:0"
as the explanation for swapper:0.
Example:
*A0 228836.978985 secs A0 => perf:23032
* . A0 228836.979016 secs . => swapper:0
. *B0 228836.979099 secs B0 => migration/3:22
*A0 . B0 228836.979115 secs
A0 . * . 228836.979115 secs
A0 *C0 . 228836.979225 secs C0 => ksoftirqd/2:18
A0 *D0 . 228836.979236 secs D0 => rcu_sched:7
Signed-off-by: Dongsheng <yangds.fnst@cn.fujitsu.com >
Acked-by: Ingo Molnar <mingo@kernel.org >
Link: http://lkml.kernel.org/r/1399354741-19522-1-git-send-email-yangds.fnst@cn.fujitsu.com
[ small style fixes to make checkpatch happy ]
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-12 11:09:05 +02:00
Dongsheng
e936e8e459
perf tools: Adapt the TASK_STATE_TO_CHAR_STR to new value in kernel space.
...
Currently, TASK_STATE_TO_CHAR_STR in kernel space is already expanded to RSDTtZXxKWP,
but it is still RSDTtZX in perf sched tool.
This patch update TASK_STATE_TO_CHAR_STR to the new value in kernel space.
Signed-off-by: Dongsheng <yangds.fnst@cn.fujitsu.com >
Link: http://lkml.kernel.org/r/6d2f55dc1e02c1e29a5d70bfeb9d6e8863caf2aa.1399273302.git.yangds.fnst@cn.fujitsu.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-12 10:01:49 +02:00
Dongsheng
7fff959783
perf tools: Add missing event for perf sched record.
...
We should record and process sched:sched_wakeup_new event in
perf sched tool, but currently, there is the process function
for it, without recording it in record subcommand.
This patch add -e sched:sched_wakeup_new to perf sched record.
Signed-off-by: Dongsheng <yangds.fnst@cn.fujitsu.com >
Link: http://lkml.kernel.org/r/710c6edd2162b2cea1711443f54de47c0210d9fd.1399273302.git.yangds.fnst@cn.fujitsu.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-12 10:01:41 +02:00
Jiri Olsa
73a31b7c6a
perf tools: Move ACCESS_ONCE from perf.h header
...
Into tools/include/linux/compiler.h header.
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Acked-by: Peter Zijlstra <peterz@infradead.org >
Cc: Arnaldo Carvalho de Melo <acme@kernel.org >
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/n/tip-9sk90owm370kuq3f0ssjjui2@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-05 17:49:07 +02:00
Jiri Olsa
82baa0eb46
perf tools: Move sys_perf_event_open function from perf.h
...
Into perf-sys.h header, as requested by Peter:
http://lkml.kernel.org/r/20140502115201.GI30445@twins.programming.kicks-ass.net
Adding HAVE_ATTR_TEST define to turn off/on the attribute
test code in the sys_perf_event_open function.
Requested-by: Peter Zijlstra <a.p.zijlstra@chello.nl >
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Acked-by: Peter Zijlstra <peterz@infradead.org >
Cc: Arnaldo Carvalho de Melo <acme@kernel.org >
Cc: Borislav Petkov <bp@suse.de >
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1399293219-8732-10-git-send-email-jolsa@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-05 17:48:51 +02:00
Jiri Olsa
43599d1f7a
perf tools: Move syscall and arch specific defines from perf.h
...
Into new perf-sys.h header.
The main reason is to separate system specific perf data
from perf tool stuff, so it could be used in small test
programs, as requested Peter:
http://lkml.kernel.org/r/20140502115201.GI30445@twins.programming.kicks-ass.net
This separation makes the perf.h header more clear.
Requested-by: Peter Zijlstra <a.p.zijlstra@chello.nl >
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Acked-by: Peter Zijlstra <peterz@infradead.org >
Cc: Arnaldo Carvalho de Melo <acme@kernel.org >
Cc: Borislav Petkov <bp@suse.de >
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1399293219-8732-9-git-send-email-jolsa@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-05 17:48:28 +02:00
Jiri Olsa
2c83bc08e3
perf tools: Move perf_call_graph_mode enum from perf.h
...
Into util/callchain.h header where all callchain related
structures should be.
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Acked-by: Peter Zijlstra <peterz@infradead.org >
Cc: Arnaldo Carvalho de Melo <acme@kernel.org >
Cc: Borislav Petkov <bp@suse.de >
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1399293219-8732-8-git-send-email-jolsa@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-05 17:48:10 +02:00
Jiri Olsa
0776eb5935
perf tools: Move sample data structures from perf.h
...
Into util/event.h header where all sample data structures
are defined.
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Acked-by: Peter Zijlstra <peterz@infradead.org >
Cc: Arnaldo Carvalho de Melo <acme@kernel.org >
Cc: Borislav Petkov <bp@suse.de >
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1399293219-8732-7-git-send-email-jolsa@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-05-05 17:47:40 +02:00