diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-03-03 20:46:34 -0500 |
---|---|---|
committer | Jiri Olsa <jolsa@kernel.org> | 2014-05-21 05:45:35 -0400 |
commit | a7d945bc91602f916d2d0c794c179d9a784859e7 (patch) | |
tree | 40b0b84ec5ec0a624cbad51b7342a6ae44903def /tools/perf/ui | |
parent | 22af969e8cfc6ea46d3e1a774a16d7e19b8cf4db (diff) |
perf report: Add -F option to specify output fields
The -F/--fields option is to allow user setup output field in any
order. It can receive any sort keys and following (hpp) fields:
overhead, overhead_sys, overhead_us, sample and period
If guest profiling is enabled, overhead_guest_{sys,us} will be
available too.
The output fields also affect sort order unless you give -s/--sort
option. And any keys specified on -s option, will also be added to
the output field list automatically.
$ perf report -F sym,sample,overhead
...
# Symbol Samples Overhead
# .......................... ............ ........
#
[.] __cxa_atexit 2 2.50%
[.] __libc_csu_init 4 5.00%
[.] __new_exitfn 3 3.75%
[.] _dl_check_map_versions 1 1.25%
[.] _dl_name_match_p 4 5.00%
[.] _dl_setup_hash 1 1.25%
[.] _dl_sysdep_start 1 1.25%
[.] _init 5 6.25%
[.] _setjmp 6 7.50%
[.] a 8 10.00%
[.] b 8 10.00%
[.] brk 1 1.25%
[.] c 8 10.00%
Note that, the example output above is captured after applying next
patch which fixes sort/comparing behavior.
Requested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/1400480762-22852-12-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r-- | tools/perf/ui/hist.c | 59 |
1 files changed, 55 insertions, 4 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 24116a48298f..b114c6668865 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -355,6 +355,12 @@ void perf_hpp__init(void) | |||
355 | INIT_LIST_HEAD(&fmt->sort_list); | 355 | INIT_LIST_HEAD(&fmt->sort_list); |
356 | } | 356 | } |
357 | 357 | ||
358 | /* | ||
359 | * If user specified field order, no need to setup default fields. | ||
360 | */ | ||
361 | if (field_order) | ||
362 | return; | ||
363 | |||
358 | perf_hpp__column_enable(PERF_HPP__OVERHEAD); | 364 | perf_hpp__column_enable(PERF_HPP__OVERHEAD); |
359 | 365 | ||
360 | if (symbol_conf.show_cpu_utilization) { | 366 | if (symbol_conf.show_cpu_utilization) { |
@@ -377,8 +383,6 @@ void perf_hpp__init(void) | |||
377 | list = &perf_hpp__format[PERF_HPP__OVERHEAD].sort_list; | 383 | list = &perf_hpp__format[PERF_HPP__OVERHEAD].sort_list; |
378 | if (list_empty(list)) | 384 | if (list_empty(list)) |
379 | list_add(list, &perf_hpp__sort_list); | 385 | list_add(list, &perf_hpp__sort_list); |
380 | |||
381 | perf_hpp__setup_output_field(); | ||
382 | } | 386 | } |
383 | 387 | ||
384 | void perf_hpp__column_register(struct perf_hpp_fmt *format) | 388 | void perf_hpp__column_register(struct perf_hpp_fmt *format) |
@@ -403,8 +407,55 @@ void perf_hpp__setup_output_field(void) | |||
403 | 407 | ||
404 | /* append sort keys to output field */ | 408 | /* append sort keys to output field */ |
405 | perf_hpp__for_each_sort_list(fmt) { | 409 | perf_hpp__for_each_sort_list(fmt) { |
406 | if (list_empty(&fmt->list)) | 410 | if (!list_empty(&fmt->list)) |
407 | perf_hpp__column_register(fmt); | 411 | continue; |
412 | |||
413 | /* | ||
414 | * sort entry fields are dynamically created, | ||
415 | * so they can share a same sort key even though | ||
416 | * the list is empty. | ||
417 | */ | ||
418 | if (perf_hpp__is_sort_entry(fmt)) { | ||
419 | struct perf_hpp_fmt *pos; | ||
420 | |||
421 | perf_hpp__for_each_format(pos) { | ||
422 | if (perf_hpp__same_sort_entry(pos, fmt)) | ||
423 | goto next; | ||
424 | } | ||
425 | } | ||
426 | |||
427 | perf_hpp__column_register(fmt); | ||
428 | next: | ||
429 | continue; | ||
430 | } | ||
431 | } | ||
432 | |||
433 | void perf_hpp__append_sort_keys(void) | ||
434 | { | ||
435 | struct perf_hpp_fmt *fmt; | ||
436 | |||
437 | /* append output fields to sort keys */ | ||
438 | perf_hpp__for_each_format(fmt) { | ||
439 | if (!list_empty(&fmt->sort_list)) | ||
440 | continue; | ||
441 | |||
442 | /* | ||
443 | * sort entry fields are dynamically created, | ||
444 | * so they can share a same sort key even though | ||
445 | * the list is empty. | ||
446 | */ | ||
447 | if (perf_hpp__is_sort_entry(fmt)) { | ||
448 | struct perf_hpp_fmt *pos; | ||
449 | |||
450 | perf_hpp__for_each_sort_list(pos) { | ||
451 | if (perf_hpp__same_sort_entry(pos, fmt)) | ||
452 | goto next; | ||
453 | } | ||
454 | } | ||
455 | |||
456 | perf_hpp__register_sort_field(fmt); | ||
457 | next: | ||
458 | continue; | ||
408 | } | 459 | } |
409 | } | 460 | } |
410 | 461 | ||