Jiri Olsa
98ba160929
perf tools: Make several display functions global
...
Will be used from external places in the upcoming c2c patch series.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Don Zickus <dzickus@redhat.com >
Cc: Joe Mario <jmario@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1474558645-19956-8-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-09-22 13:08:58 -03:00
Jiri Olsa
9da44db149
perf hists: Add __hist_entry__snprintf function
...
Add __hist_entry__snprintf() to take a perf_hpp_list as an argument
instead of using he->hists->hpp_list.
This way we can display arbitrary list of entries regardless of the
hists setup, which will be useful in the upcoming c2c patch series.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Don Zickus <dzickus@redhat.com >
Cc: Joe Mario <jmario@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1474558645-19956-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-09-22 13:08:56 -03:00
Jiri Olsa
d5278220be
perf hists: Use bigger buffer for stdio headers
...
With node column on big CPUs servers we can run out of stdio header
space quite soon. Enlarging header buffer.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Don Zickus <dzickus@redhat.com >
Cc: Joe Mario <jmario@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1474290610-23241-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-09-21 12:14:59 -03:00
Namhyung Kim
e3b60bc93d
perf hists: Factor out hists__reset_column_width()
...
The stdio and tui has same code to reset hpp format column width.
Factor it out as a new function.
Suggested-and-Acked-by: Jiri Olsa <jolsa@redhat.com >
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20160920053025.13989-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-09-20 16:13:37 -03:00
Namhyung Kim
5ff3e7a224
perf ui/tui: Reset output width for hierarchy
...
When --hierarchy option is used, each entry has its own hpp_list to show
the result. But it missed to update width of each column.
Before:
- 46.29% 48.12% netctl-auto
+ 31.44% 29.25% [kernel.vmlinux]
+ 8.52% 11.55% libc-2.22.so
+ 5.19% 6.91% bash
+ 10.75% 11.83% wpa_cli
+ 8.25% 2.23% swapper
+ 6.45% 5.40% tr
+ 4.81% 8.09% awk
+ 4.15% 2.85% firefox
+ 3.86% 2.53% sh
After:
- 46.29% 48.12% netctl-auto
+ 31.44% 29.25% [kernel.vmlinux]
+ 8.52% 11.55% libc-2.22.so
+ 5.19% 6.91% bash
+ 10.75% 11.83% wpa_cli
+ 8.25% 2.23% swapper
+ 6.45% 5.40% tr
+ 4.81% 8.09% awk
+ 4.15% 2.85% firefox
+ 3.86% 2.53% sh
Committer note:
Full testing instructions:
1) Record with an event group:
$ perf record -e '{cycles,instructions}' make -j4
2) Use report in hierarchy mode, to get a few expanded trees on
the same screen, use --percent-limit:
$ perf report --hierarchy --percent-limit 0.5
Samples: 103K of event 'anon group { cycles:u, instructions:u }',
Event count (approx.): 57317631725
Overhead Command / Shared Object / Symbol ◆
- 58.89% 55.12% cc1 ▒
- 50.26% 48.10% cc1 ▒
3.61% 5.13% [.] _cpp_lex_token ▒
2.58% 0.78% [.] ht_lookup_with_hash ▒
1.31% 1.30% [.] ggc_internal_alloc ▒
1.08% 2.25% [.] get_combined_adhoc_loc ▒
1.01% 1.95% [.] ira_init ▒
0.96% 1.78% [.] linemap_position_for_column ▒
0.65% 1.01% [.] cpp_get_token_with_location ▒
- 7.52% 6.58% libc-2.23.so ▒
1.70% 1.78% [.] _int_malloc ▒
0.69% 0.75% [.] _int_free ▒
0.67% 0.42% [.] malloc_consolidate ▒
- 0.58% 0.42% ld-2.23.so ▒
no entry >= 0.50% ▒
- 0.52% 0.03% [kernel.vmlinux] ▒
no entry >= 0.50% ▒
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Fixes: 1b2dbbf41a
("perf hists: Use own hpp_list for hierarchy mode")
Link: http://lkml.kernel.org/r/20160920053025.13989-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-09-20 16:08:30 -03:00
Namhyung Kim
195bc0f844
perf ui/stdio: Rename print_hierarchy_header()
...
Now the hists__fprintf_hierarchy_headers() is a simple wrapper passing
field separator. Let's do it directly.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/20160913074552.13284-6-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-09-13 16:41:36 -03:00
Namhyung Kim
9a6ad25b5a
perf ui/stdio: Always reset output width for hierarchy
...
When the --hierarchy option is used, each entry has its own hpp_list to
show the result. But it is not updating the width of each column for
perf-top. The perf-report command has no problem since it resets it
during header display.
$ sudo perf top --hierarchy --stdio
PerfTop: 160 irqs/sec kernel:38.8% exact: 100.0%
[4000Hz cycles:pp], (all, 12 CPUs)
----------------------------------------------------------------------
52.32% perf
24.74% [.] __symbols__insert
5.62% [.] rb_next
5.14% [.] dso__load_sym
Move the code into hists__fprintf() so that it can be called always.
Also it'd be better to put similar code together.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Fixes: 1b2dbbf41a
("perf hists: Use own hpp_list for hierarchy mode")
Link: http://lkml.kernel.org/r/20160913074552.13284-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-09-13 16:41:21 -03:00
Namhyung Kim
d9ea48bc4e
perf hists browser: Fix event group display
...
Milian reported that the event group on TUI shows duplicated overhead.
This was due to a bug on calculating hpp->buf position. The
hpp_advance() was called from __hpp__slsmg_color_printf() on TUI but
it's already called from the hpp__call_print_fn macro in __hpp__fmt().
The end result is that the print function returns number of bytes it
printed but the buffer advanced twice of the length.
This is generally not a problem since it doesn't need to access the
buffer again. But with event group, overhead needs to be printed
multiple times and hist_entry__snprintf_alignment() tries to fill the
space with buffer after it printed. So it (brokenly) showed the last
overhead again.
The bug was there from the beginning, but I think it's only revealed
when the alignment function was added.
Reported-by: Milian Wolff <milian.wolff@kdab.com >
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Fixes: 89fee70943
("perf hists: Do column alignment on the format iterator")
Link: http://lkml.kernel.org/r/20160912061958.16656-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-09-12 11:10:26 -03:00
Arnaldo Carvalho de Melo
be39db9f29
perf symbols: Remove symbol_filter_t machinery
...
We're not using it anymore, few users were, but we really could do
without it, simplify lots of functions by removing it.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-1zng8wdznn00iiz08bb7q3vn@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-09-05 11:14:50 -03:00
Colin Ian King
6637e6f1ac
perf hists browser: Remove superfluous null check on map
...
'map' is being already checked if it is NULL at the start of
do_zoom_dso(), so the second subsequent check is superfluous and can be
removed.
Signed-off-by: Colin King <colin.king@canonical.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Pekka Enberg <penberg@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/r/1471278343-14999-1-git-send-email-colin.king@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-08-23 15:37:33 -03:00
Jiri Olsa
29659ab4e7
perf hists: Add support for header span
...
Add span argument for header callback function.
The handling of this argument is completely in the hands of the
callback. The only thing the caller ensures is it's zeroed on the
beginning.
Omitting span skipping in hierarchy headers and gtk code.
The c2c code use this to span header lines based on the entries span
configuration.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1470583710-1649-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-08-23 15:37:33 -03:00
Jiri Olsa
f3705b062e
perf tools stdio: Display multiple header lines
...
Display multiple header lines in stdio output , if it's configured
within struct perf_hpp_list::nr_header_lines.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1470583710-1649-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-08-23 15:37:33 -03:00
Jiri Olsa
69705b3585
perf tools tui: Display multiple header lines
...
Display multiple header lines in TUI browser, if it's configured within
struct perf_hpp_list::nr_header_lines.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1470583710-1649-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-08-23 15:37:33 -03:00
Jiri Olsa
74bb43f29e
perf hists: Add line argument into perf_hpp_fmt's header callback
...
Adding line argument into perf_hpp_fmt's header callback to be able to
request specific header line.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1470583710-1649-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-08-23 15:37:33 -03:00
Jiri Olsa
f8e6710de8
perf hists: Introduce nr_header_lines into struct perf_hpp_list
...
Currently we support just single line headers, this is first step to
allow more.
Store the number of header lines in perf_hpp_list, which encompasses all
the display/sort entries and is thus suitable to hold this value.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1470583710-1649-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-08-23 15:37:33 -03:00
Arnaldo Carvalho de Melo
ee51d85139
perf annotate: Introduce strerror for handling symbol__disassemble() errors
...
We were just using pr_error() which makes it difficult for non stdio UIs
to provide errors using its widgets, as they need to somehow catch what
was passed to pr_error().
Fix it by introducing a __strerror() interface like the ones used
elsewhere, for instance target__strerror().
This is just the initial step, more work will be done, but first some
error handling bugs noticed while working on this need to be dealt with.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-dgd22zl2xg7x4vcnoa83jxfb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-08-01 18:18:16 -03:00
Arnaldo Carvalho de Melo
5cb725a972
perf annotate: Rename symbol__annotate() to symbol__disassemble()
...
This function will not annotate anything, it will just disassembly the
given map->dso and symbol.
It currently does this by parsing the output of 'objdump --disassemble',
but this could conceivably be done using a library or an offshot of
the kernel's instruction decoder (arch/x86/lib/inat.c), etc.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-2xpfl4bfnrd6x584b390qok7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-08-01 17:06:46 -03:00
Arnaldo Carvalho de Melo
175729fc2c
perf tools: Remove needless includes from cache.h
...
The cache.h header doesn't use any of the definitions in some of the
headers it includes, ditch them and fix the fallout, where files were
getting stuff they needed just because they were including it, sometimes
not using what it really exports at all.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-l6r2bmj8h1g3e01wr981on0n@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-12 15:19:58 -03:00
Arnaldo Carvalho de Melo
c8b5f2c96d
tools: Introduce str_error_r()
...
The tools so far have been using the strerror_r() GNU variant, that
returns a string, be it the buffer passed or something else.
But that, besides being tricky in cases where we expect that the
function using strerror_r() returns the error formatted in a provided
buffer (we have to check if it returned something else and copy that
instead), breaks the build on systems not using glibc, like Alpine
Linux, where musl libc is used.
So, introduce yet another wrapper, str_error_r(), that has the GNU
interface, but uses the portable XSI variant of strerror_r(), so that
users rest asured that the provided buffer is used and it is what is
returned.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-d4t42fnf48ytlk8rjxs822tf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-12 15:19:47 -03:00
Arnaldo Carvalho de Melo
c09615f29c
perf ui stdio: Add way to setup the color output mode selection
...
In --stdio we turn off color output when the output is not a tty,
which is not always desirable, for instance, in:
perf annotate | more
the 'more' tool is perfectly capable of processing the escape sequences
for colored output.
Allow using the existing logic for .perfconfig's "color.ui" to be used
from the command line by providing a stdio__config_color() helper, that
will be used by annotate and report in follow up patches.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-1u4wjdbcc41dxndsb4klpa9y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-12 00:00:39 -03:00
Naveen N. Rao
6ef9492915
perf annotate: Generalize handling of 'ret' instructions
...
Introduce helper to detect 'ret' instructions and use the same in the TUI.
A helper is needed since some architectures such as powerpc have more
than one return instruction.
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com >
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com >
Cc: Anton Blanchard <anton@ozlabs.org >
Cc: Daniel Axtens <dja@axtens.net >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Link: http://lkml.kernel.org/r/1466769240-12376-5-git-send-email-ravi.bangoria@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-27 14:25:05 -03:00
Arnaldo Carvalho de Melo
e5cadb93d0
perf evlist: Rename for_each() macros to for_each_entry()
...
To match the semantics for list.h in the kernel, that are used to
implement those macros.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Milian Wolff <milian.wolff@kdab.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Taeung Song <treeze.taeung@gmail.com >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-qbcjlgj0ffxquxscahbpddi3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-23 11:26:15 -03:00
Taeung Song
41840d211c
perf config: Move config declarations from util/cache.h to util/config.h
...
Lately util/config.h has been added but util/cache.h has declarations of
functions and a global variable for config features.
To manage codes about configuration at one spot, move them to
util/config.h and let source files that need config features include
config.h And if the source files that included previous cache.h need
only config.h, remove including cache.h.
Signed-off-by: Taeung Song <treeze.taeung@gmail.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/r/1466672119-4852-2-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-23 08:51:41 -03:00
Jiri Olsa
fcd8642650
perf hists browser: Introduce init()
...
Factoring out the hist_browser initialization code, so it could be used
from other parts in following patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1466459899-1166-8-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-22 09:56:35 -03:00
Jiri Olsa
a6ec894dea
perf hists browser: Introduce perf_evsel_browser constructor
...
So we could use hist_browser__new for generic hist browser in following
patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1466459899-1166-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-22 09:56:35 -03:00
Jiri Olsa
b1c7a8f7a1
perf hists browser: Move horizontal scroll init to new()
...
Moving horizontal scroll init to initialization function as already
intended.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1466459899-1166-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-22 09:56:35 -03:00
Jiri Olsa
5b91a86f47
perf hists browser: Introduce struct hist_browser title callback
...
We can now setup title callback for hist_browser, which will be useful
in following changes to create customized hist_browsers.
This also separates struct perf_evsel dependency out of hist_browser
basic code.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1466459899-1166-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-22 09:56:34 -03:00
Jiri Olsa
dabd201239
perf hists browser: Make (new|delete|run) public
...
This way we can use it outside of ui/browsers/hists.c and extend it in
following patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1466459899-1166-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-22 09:56:34 -03:00
Jiri Olsa
f758990f25
perf hists browser: Move hist_browser into header file
...
This way we can use it outside of ui/browsers/hists.c and extend it in
following patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1466459899-1166-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-22 09:56:34 -03:00
Jiri Olsa
da1b0407c8
perf hists: Replace perf_evsel arg perf_hpp_fmt's width callback
...
Replacing perf_evsel arg perf_hpp_fmt's width callback with hists
object.
This will be helpful in future for non evsel related hist browsers.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1465928361-2442-11-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-15 10:50:04 -03:00
Jiri Olsa
0537217360
perf hists: Replace perf_evsel arg perf_hpp_fmt's header callback
...
Replacing perf_evsel arg perf_hpp_fmt's header callback with hists
object.
None of the actual callbacks actually use evsel object, also this will
be helpful in future for non evsel related hist browsers.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1465928361-2442-10-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-15 10:49:18 -03:00
Jiri Olsa
d05e3aaeea
perf stdio: Add use_callchain parameter to hists__fprintf
...
It will be convenient in following patches to display hists entries
without callchains even if they are defined.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1465928361-2442-9-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-15 10:48:02 -03:00
Jiri Olsa
8f1d1b4452
perf stdio: Do not pass hists in hist_entry__fprintf
...
There's no need, we have the hists pointer in struct hist_entry.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1465928361-2442-8-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-15 10:47:11 -03:00
Jiri Olsa
7a72a2e5e6
perf stdio: Separate standard headers output
...
Introducing hists__fprintf_standard_headers function to separate
standard headers display code.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1465928361-2442-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-15 10:46:39 -03:00
Jiri Olsa
5c854f3793
perf stdio: Separate hierarchy headers output
...
Introducing hists__fprintf_hierarchy_headers function to separate
hierarchy headers display code.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1465928361-2442-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-15 10:46:02 -03:00
Jiri Olsa
36592ebb73
perf stdio: Separate headers output
...
Introducing hists__fprintf_headers function to separate the code that
displays headers.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1465928361-2442-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-15 10:44:26 -03:00
Jiri Olsa
01b4770d56
perf tui: Separate hierarchy and standard headers output
...
It will be useful for future changes that enhance headers with multiple
lines and span columns, which don't affect hierarchy headers.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1465928361-2442-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-15 10:44:22 -03:00
Jiri Olsa
7cecb7fe83
perf hists: Move sort__has_comm into struct perf_hpp_list
...
Now we have sort dimensions private for struct hists,
we need to make dimension booleans hists specific as
well.
Moving sort__has_comm into struct perf_hpp_list.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1462276488-26683-8-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-05-05 21:04:02 -03:00
Jiri Olsa
fa82911a1b
perf hists: Move sort__has_thread into struct perf_hpp_list
...
Now we have sort dimensions private for struct hists, we need to make
dimension booleans hists specific as well.
Moving sort__has_thread into struct perf_hpp_list.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1462276488-26683-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-05-05 21:04:01 -03:00
Jiri Olsa
35a634f76c
perf hists: Move sort__has_socket into struct perf_hpp_list
...
Now we have sort dimensions private for struct hists, we need to make
dimension booleans hists specific as well.
Moving sort__has_socket into struct perf_hpp_list.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1462276488-26683-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-05-05 21:04:01 -03:00
Jiri Olsa
69849fc5d2
perf hists: Move sort__has_dso into struct perf_hpp_list
...
Now we have sort dimensions private for struct hists, we need to make
dimension booleans hists specific as well.
Moving sort__has_dso into struct perf_hpp_list.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1462276488-26683-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-05-05 21:04:00 -03:00
Jiri Olsa
2e0453af4e
perf hists: Move sort__has_sym into struct perf_hpp_list
...
Now we have sort dimensions private for struct hists, we need to make
dimension booleans hists specific as well.
Moving sort__has_sym into struct perf_hpp_list.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1462276488-26683-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-05-05 21:03:59 -03:00
Arnaldo Carvalho de Melo
1b6b678ecf
perf hists browser: Fold two consecutive symbol_conf.use_callchain ifs
...
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Milian Wolff <milian.wolff@kdab.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-u701i6qpecgm9jiat52i8l98@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-18 12:26:27 -03:00
Jiri Olsa
7d6a7e7825
perf tools: Introduce trim function
...
To be used in cases for both sides trim.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andreas Hollmann <hollmann@in.tum.de >
Cc: David Ahern <dsahern@gmail.com >
Cc: Milian Wolff <milian.wolff@kdab.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1460013073-18444-1-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-07 10:21:49 -03:00
Andres Freund
9098903555
perf hists: Fix determination of a callchain node's childlessness
...
The 4b3a321223
("perf hists browser: Support flat callchains") commit
over-aggressively tried to optimize callchain_node__init_have_children().
That lead to --tui mode not allowing to expand call chain elements if a
call chain element had only one parent. That's why --inverted callgraphs
looked halfway sane, but plain ones didn't.
Revert that individual optimization, it wasn't really related to the
rest of the commit.
Signed-off-by: Andres Freund <andres@anarazel.de >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Fixes: 4b3a321223
("perf hists browser: Support flat callchains")
Link: http://lkml.kernel.org/r/20160330190245.GB13305@awork2.anarazel.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-03-30 18:08:39 -03:00
Arnaldo Carvalho de Melo
b8f8eb84f4
perf tools: Remove misplaced __maybe_unused
...
All over the tree.
Cc: David Ahern <dsahern@gmail.com >
cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com >
Link: http://lkml.kernel.org/n/tip-8nzhnokxyp8y4v7gf0j00oyb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-03-23 12:03:04 -03:00
Namhyung Kim
599a2f38a9
perf hists browser: Check sort keys before hot key actions
...
The context menu in TUI hists browser checks corresponding sort keys
when creating the menu item. But hotkey actions lacks these checks so
it can filter using incorrect info.
For example, default sort key of 'perf top' doesn't contain 'comm' or
'pid' sort key so each hist entry's thread info is not reliable. Thus
it should prohibit using thread filter on 't' key.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/1457533253-21419-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-03-10 16:48:02 -03:00
Namhyung Kim
6962ccb37b
perf hists browser: Allow thread filtering for comm sort key
...
The commit 2eafd410e6
("perf hists browser: Only 'Zoom into thread'
only when sort order has 'pid'") disabled thread filtering in hist
browser for the default sort key. However the he->thread is still valid
even if 'pid' sort key is not given. Only thing it should not use is
the pid (or tid) of the thread. So allow to filter by thread when
'comm' sort key is given and show pid only if 'pid' sort key is given.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/1457536490-24084-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-03-10 16:47:37 -03:00
Namhyung Kim
86e3ee5224
perf tools: Remove nr_sort_keys field
...
The nr_sort_keys field is to carry the number of sort entries in a
hpp_list or hists to determine the depth of indentation of a hist entry.
As it's only used in hierarchy mode and now we have used nr_hpp_node for
this reason, there's no need to keep it anymore. Let's get rid of it.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Tested-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/r/1457531222-18130-7-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-03-10 16:46:08 -03:00
Namhyung Kim
325a62834e
perf hists browser: Cleanup hist_browser__fprintf_hierarchy_entry()
...
The hist_browser__fprintf_hierarchy_entry() if to dump current output
into a file so it needs to be sync-ed with the corresponding function
hist_browser__show_hierarchy_entry(). So use hists->nr_hpp_node to
indent width and use first fmt_node to print overhead columns instead of
checking whether it's a sort entry (or dynamic entry).
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Tested-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/r/1457531222-18130-6-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-03-10 16:46:04 -03:00