perf tools: Display tracepoint enahncements
cover perf tools: Display tracepoint enahncements
hi,
sending out tracepoint (mostly) events display enahncements.
* adding the '--tp' option for report command to show tracepoint related info. Use can specify following switches:
fields: shows separated tracepoint fields
format: shows tracepoints 'print fmt' in single column
(This is default if no switch is given.)
$ perf report --tp --no-children
Samples: 4K of event 'sched:sched_switch', Event count (approx.): 4788
Overhead Command Shared Object Symbol Print fmt
+ 26.27% swapper [kernel.kallsyms] [k] __schedule swapper/2:0 [120] R ==> offlineimap:22134 [120]
+ 26.27% offlineimap [kernel.kallsyms] [k] __schedule offlineimap:22134 [120] S ==> swapper/2:0 [120]
- 8.15% swapper [kernel.kallsyms] [k] __schedule swapper/3:0 [120] R ==> offlineimap:22134 [120]
__schedule
schedule_preempt_disabled
cpu_startup_entry
start_secondary
+ 8.15% offlineimap [kernel.kallsyms] [k] __schedule offlineimap:22134 [120] S ==> swapper/3:0 [120] $ perf report --tp=fields --no-children
Samples: 4K of event 'sched:sched_switch', Event count (approx.): 4788
Overhead Command Shared Object Symbol prev_comm prev_pid prev_prio prev_state next_comm next_pid next_prio
+ 26.27% swapper [kernel.kallsyms] [k] __schedule swapper/2 0 120 0 offlineimap 22134 120
+ 26.27% offlineimap [kernel.kallsyms] [k] __schedule offlineimap 22134 120 1 swapper/2 0 120
- 8.15% swapper [kernel.kallsyms] [k] __schedule swapper/3 0 120 0 offlineimap 22134 120
__schedule
schedule_preempt_disabled
cpu_startup_entry
start_secondary
+ 8.15% offlineimap [kernel.kallsyms] [k] __schedule offlineimap 22134 120 1 swapper/3 0 120* adding '--list' report option to display entries sequentialy:
Samples: 2K of event 'sched:sched_switch', Event count (approx.): 2450
Self Children Time Command Shared Object Symbol Print fmt
+ 0.04% 0.04% 9582.431783 +000000.000000 swapper [kernel.kallsyms] [k] __schedule swapper/1:0 [120] R ==> perf:11168 [120]
- 0.00% 0.04% 9582.431783 +000000.000000 swapper [kernel.kallsyms] [k] __schedule swapper/1:0 [120] R ==> perf:11168 [120]
__schedule
schedule
cpu_idle
start_secondary
+ 0.00% 0.04% 9582.431783 +000000.000000 swapper [kernel.kallsyms] [k] schedule swapper/1:0 [120] R ==> perf:11168 [120]
+ 0.00% 0.04% 9582.431783 +000000.000000 swapper [kernel.kallsyms] [k] cpu_idle swapper/1:0 [120] R ==> perf:11168 [120]* adding 'H' key handler to togle header columns
thanks for comments,
jirka
---
Jiri Olsa (22):
perf tools: Fix memory leak in event_format__print function perf tools: Add time sort entry
perf tools: Add idx sort entry
perf tools: Add --list report option
perf tools: Add sort_entry struct into sort entries callbacks perf tools: Add selected bool into se_snprintf sort entries callback perf tools: Implement selected bool se_snprintf callback logic perf tools: Implement selected logic for time sort entry perf tools: Factor ui_browser ops out of ui_browser struct perf tools: Add header callback into ui_browser_ops struct perf tools: Remove ev_name argument from perf_evsel__hists_browse perf tools: Add header callback to hist browser
perf tools: Factor hpp_arg struct to carry hist_browser perf tools tui: Display columns header text on 'H' press tools lib traceevent: Factor print_event_fields function tools lib traceevent: Make the name output optional in pevent_field_info tools lib traceevent: Add pevent_field_cmp function
perf tools: Factor sort entries loops
perf tools: Add local hists sort entry list
perf tools: Make hists col_len dynamicaly alocated
perf tools: Add raw info into hist entry
perf tools: Add support for tracepoint fields
tools/lib/traceevent/event-parse.c | 181 +++++++++++++++++++++---------- tools/lib/traceevent/event-parse.h | 10 ++ tools/perf/Documentation/perf-report.txt | 6 ++ tools/perf/Makefile.perf | 1 + tools/perf/builtin-annotate.c | 4 +- tools/perf/builtin-diff.c | 4 +- tools/perf/builtin-report.c | 52 ++++++++- tools/perf/tests/hists_link.c | 6 +- tools/perf/ui/browser.c | 101 ++++++++++++----- tools/perf/ui/browser.h | 31 ++++-- tools/perf/ui/browsers/annotate.c | 19 ++-- tools/perf/ui/browsers/header.c | 8 +- tools/perf/ui/browsers/hists.c | 168 ++++++++++++++++++++++------- tools/perf/ui/browsers/map.c | 8 +- tools/perf/ui/browsers/scripts.c | 2 +- tools/perf/ui/gtk/hists.c | 8 +- tools/perf/ui/hist.c | 10 +- tools/perf/ui/stdio/hist.c | 6 +- tools/perf/ui/tui/util.c | 8 +- tools/perf/util/evsel.c | 24 +++-- tools/perf/util/evsel.h | 6 +- tools/perf/util/hist.c | 65 ++++++++--- tools/perf/util/hist.h | 20 +++- tools/perf/util/python.c | 3 +- tools/perf/util/report-tp.c | 244 +++++++++++++++++++++++++++++++++++++++++ tools/perf/util/report-tp.h | 18 ++++ tools/perf/util/sort.c | 370 +++++++++++++++++++++++++++++++++++++++++++++++++-------------- tools/perf/util/sort.h | 29 ++++- tools/perf/util/symbol.h | 3 +- tools/perf/util/trace-event-parse.c | 1 + tools/perf/util/util.h | 17 +++ 31 files changed, 1144 insertions(+), 289 deletions(-) create mode 100644 tools/perf/util/report-tp.c create mode 100644 tools/perf/util/report-tp.h
PATCH 1/22 perf tools: Fix memory leak in event_format__print function
Properly destroying trace_seq object.
--- tools/perf/util/trace-event-parse.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/trace-event-parse.c +1 -0
@@ -126,6 +126,7 @@ void event_format__print(struct event_format *event,trace_seq_init (&s);pevent_event_info (&s, event, &record);trace_seq_do_printf (&s); +trace_seq_destroy (&s); } void parse_proc_kallsyms(struct pevent *pevent,
Signature · 1 line
1.8.3.1
Re: [PATCH 01/22] perf tools: Fix memory leak in event_format__print function
Quoted 6 lines · Jiri Olsa
Properly destroying
trace_seqobject.Signed-off-by Jiri Olsa <[email protected]>Cc Corey Ashford <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Ingo Molnar <[email protected]>
Thanks,
Namhyung
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf tools: Fix memory leak in event_format__print function
In reply to Jiri Olsaperf tools: Fix memory leak in event_format__print function
Commit-ID: b58f608e31010cb76ee953a6919f9d96b4eb58d9 Gitweb: http://git.kernel.org/tip/b58f608e31010cb76ee953a6919f9d96b4eb58d9 Author: Jiri Olsa <[email protected]> AuthorDate: Sun, 2 Feb 2014 22:38:49 +0100 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 18 Feb 2014 09:34:47 -0300
perf tools: Fix memory leak in event_format__print function
Properly destroying trace_seq object.
--- tools/perf/util/trace-event-parse.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/trace-event-parse.c +1 -0
@@ -126,6 +126,7 @@ void event_format__print(struct event_format *event,trace_seq_init (&s);pevent_event_info (&s, event, &record);trace_seq_do_printf (&s); +trace_seq_destroy (&s); } void parse_proc_kallsyms(struct pevent *pevent,
PATCH 2/22 perf tools: Add time sort entry
In reply to Jiri OlsaAdding time sort entry. It's mainly for displaying the time for entries for --list display in following patch.
--- tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-diff.c | 2 +- tools/perf/tests/hists_link.c | 4 ++-- tools/perf/util/hist.c | 15 ++++++++----- tools/perf/util/hist.h | 4 +++- tools/perf/util/sort.c | 52 +++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/sort.h | 2 ++ tools/perf/util/util.h | 17 ++++++++++++++ 8 files changed, 87 insertions(+), 11 deletions(-)
tools/perf/builtin-annotate.c +1 -1
@@ -65,7 +65,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,return 0 ; } - he =__hists__add_entry (&evsel->hists, al,NULL ,NULL ,NULL ,1 ,1 ,0 , + he =__hists__add_entry (&evsel->hists, al,NULL ,NULL ,NULL ,1 ,1 ,0 ,0 , true);if (he ==NULL )return -ENOMEM ;
tools/perf/builtin-diff.c +1 -1
@@ -308,7 +308,7 @@ static int hists__add_entry(struct hists *hists, u64 weight, u64 transaction) { if (__hists__add_entry(hists, al, NULL, NULL, NULL, period, weight, - transaction, true) != NULL) + transaction, 0, true) != NULL) return 0;return -ENOMEM ; }
tools/perf/tests/hists_link.c +2 -2
@@ -223,7 +223,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) goto out; he =__hists__add_entry (&evsel->hists, &al,NULL , -NULL ,NULL ,1 ,1 ,0 , true); +NULL ,NULL ,1 ,1 ,0 ,0 , true);if (he ==NULL ) goto out;
@@ -246,7 +246,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) goto out; he =__hists__add_entry (&evsel->hists, &al,NULL , -NULL ,NULL ,1 ,1 ,0 , true); +NULL ,NULL ,1 ,1 ,0 ,0 , true);if (he ==NULL ) goto out;
tools/perf/util/hist.c +9 -6
@@ -157,6 +157,8 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)if (h->transaction)hists__new_col_len (hists,HISTC_TRANSACTION ,hist_entry__transaction_len ()); + +hists__new_col_len (hists,HISTC_TIME ,32 ); }void hists__output_recalc_col_len (struct hists *hists,int max_rows)
@@ -434,7 +436,7 @@ struct hist_entry *__hists__add_entry(struct hists *hists, struct branch_info *bi, struct mem_info *mi, u64 period, u64 weight, u64 transaction, - bool sample_self) + u64 t, bool sample_self) { struct hist_entry entry = { .thread = al->thread,
@@ -457,6 +459,7 @@ struct hist_entry *__hists__add_entry(struct hists *hists, .branch_info = bi, .mem_info = mi, .transaction = transaction, + .time = t, };return add_hist_entry (hists, &entry, al, sample_self);
@@ -516,7 +519,7 @@ iter_add_single_mem_entry(struct hist_entry_iter *iter, struct addr_location *al* and the he_stat__add_period() function. */ he =__hists__add_entry (&iter->evsel->hists, al, iter->parent,NULL , mi, - cost, cost,0 , true); + cost, cost,0 ,0 , true);if (!he)return -ENOMEM ;
@@ -628,7 +631,7 @@ iter_add_next_branch_entry(struct hist_entry_iter *iter, struct addr_location *a* and not events sampled. Thus we use a pseudo period of 1. */ he =__hists__add_entry (&evsel->hists, al, iter->parent, &bi[i],NULL , -1 ,1 ,0 , true); +1 ,1 ,0 ,0 , true);if (he ==NULL )return -ENOMEM ;
@@ -674,7 +677,7 @@ iter_add_single_normal_entry(struct hist_entry_iter *iter, struct addr_location he =__hists__add_entry (&evsel->hists, al, iter->parent,NULL ,NULL , sample->period, sample->weight, - sample->transaction, true); + sample->transaction, sample->time, true);if (he ==NULL )return -ENOMEM ;
@@ -730,7 +733,7 @@ iter_add_single_cumulative_entry(struct hist_entry_iter *iter, he =__hists__add_entry (&evsel->hists, al, iter->parent,NULL ,NULL , sample->period, sample->weight, - sample->transaction, true); + sample->transaction, sample->time, true);if (he ==NULL )return -ENOMEM ;
@@ -801,7 +804,7 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter, he =__hists__add_entry (&evsel->hists, al, iter->parent,NULL ,NULL , sample->period, sample->weight, - sample->transaction, false); + sample->transaction, sample->time, false);if (he ==NULL )return -ENOMEM ;
tools/perf/util/hist.h +3 -1
@@ -69,6 +69,7 @@ enum hist_column {HISTC_MEM_LVL ,HISTC_MEM_SNOOP ,HISTC_TRANSACTION , +HISTC_TIME , HISTC_NR_COLS, /* Last entry */ };
@@ -87,6 +88,7 @@ struct hists {const char *symbol_filter_str;pthread_mutex_t lock;struct events_stats stats; +u64 time_base;u64 event_stream;u16 col_len[HISTC_NR_COLS ]; };
@@ -131,7 +133,7 @@ struct hist_entry *__hists__add_entry(struct hists *hists,struct branch_info *bi, struct mem_info *mi, u64 period, u64 weight, u64 transaction, - bool sample_self); + u64 time, bool sample_self); int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al, struct perf_evsel *evsel, const union perf_event *event, struct perf_sample *sample, int max_stack_depth,
tools/perf/util/sort.c +52 -0
70 lines not on this page · raw message
tools/perf/util/sort.h +2 -0
@@ -88,6 +88,7 @@ struct hist_entry {u64 ip;u64 transaction;s32 cpu; +u64 time;struct hist_entry_diff diff;
@@ -163,6 +164,7 @@ enum sort_type {SORT_LOCAL_WEIGHT ,SORT_GLOBAL_WEIGHT ,SORT_TRANSACTION , +SORT_TIME ,/* branch stack specific sort keys */ __SORT_BRANCH_STACK,
tools/perf/util/util.h +17 -0
@@ -75,6 +75,9 @@#include <termios.h> #include <linux/bitops.h> +#define NSECS_PER_SEC 1000000000ULL +#define NSECS_PER_USEC 1000ULL +extern const char *graph_line;extern const char *graph_dotted_line;extern char buildid_dir[];
@@ -295,6 +298,20 @@ static inline unsigned long next_pow2_l(unsigned long x)#endif } +static inline unsigned long nanotime_get_sec (u64 t) +{ +return t /NSECS_PER_SEC ; +} + +static inline unsigned long nanotime_get_usec (u64 t) +{ +unsigned long long secs; + + secs = t /NSECS_PER_SEC ; + t -= secs *NSECS_PER_SEC ; +return t /NSECS_PER_USEC ; +} +size_t hex_width (u64 v);int hex2u64 (const char *ptr,u64 *val);
Signature · 1 line
1.8.3.1
PATCH 3/22 perf tools: Add idx sort entry
In reply to Jiri OlsaAdding idx sort entry to have a way sort entries the way they are stored in the data file.
--- tools/perf/util/hist.c | 2 ++ tools/perf/util/hist.h | 1 + tools/perf/util/sort.c | 23 +++++++++++++++++++++++ tools/perf/util/sort.h | 2 ++ 4 files changed, 28 insertions(+)
tools/perf/util/hist.c +2 -0
@@ -438,6 +438,7 @@ struct hist_entry *__hists__add_entry(struct hists *hists, u64 period, u64 weight, u64 transaction, u64 t, bool sample_self) { + static u64 idx; struct hist_entry entry = { .thread = al->thread, .comm = thread__comm(al->thread),
@@ -460,6 +461,7 @@ struct hist_entry *__hists__add_entry(struct hists *hists, .mem_info = mi, .transaction = transaction, .time = t, + .idx = idx++, };return add_hist_entry (hists, &entry, al, sample_self);
tools/perf/util/hist.h +1 -0
@@ -70,6 +70,7 @@ enum hist_column {HISTC_MEM_SNOOP ,HISTC_TRANSACTION ,HISTC_TIME , +HISTC_IDX , HISTC_NR_COLS, /* Last entry */ };
tools/perf/util/sort.c +23 -0
@@ -55,6 +55,28 @@ static int64_t cmp_null(const void *l, const void *r)return 1 ; } +/* --sort idx */ + +static int64_t +sort__idx_cmp (struct hist_entry *left,struct hist_entry *right) +{ +return right->idx - left->idx; +} + +static int hist_entry__idx_snprintf (struct hist_entry *he,char *bf, +size_t size,unsigned int width) +{ +return repsep_snprintf (bf, size,"%*lu" , width, he->idx); +} + +struct sort_entry sort_idx = { + .se_header ="Idx" , + .se_cmp = sort__idx_cmp, + .se_snprintf = hist_entry__idx_snprintf, + .se_width_idx =HISTC_IDX , +}; + +/* --sort time */ static int64_t
@@ -1048,6 +1070,7 @@ static struct sort_dimension common_sort_dimensions[] = {DIM (SORT_GLOBAL_WEIGHT ,"weight" , sort_global_weight),DIM (SORT_TRANSACTION ,"transaction" , sort_transaction),DIM (SORT_TIME ,"time" , sort_time), + DIM(SORT_IDX, "idx", sort_idx), };#undef DIM
tools/perf/util/sort.h +2 -0
@@ -89,6 +89,7 @@ struct hist_entry {u64 transaction;s32 cpu;u64 time; +u64 idx;struct hist_entry_diff diff;
@@ -165,6 +166,7 @@ enum sort_type {SORT_GLOBAL_WEIGHT ,SORT_TRANSACTION ,SORT_TIME , +SORT_IDX ,/* branch stack specific sort keys */ __SORT_BRANCH_STACK,
Signature · 1 line
1.8.3.1
PATCH 4/22 perf tools: Add --list report option
In reply to Jiri OlsaAdding --list report option to display entries sequentialy:
$ perf report --list --stdio
...
0.00% 13151.543527 +000000.000000 ls [kernel.kallsyms] [k] native_write_msr_safe
0.00% 13151.543530 +000000.000003 ls [kernel.kallsyms] [k] native_write_msr_safe
0.00% 13151.543532 +000000.000005 ls [kernel.kallsyms] [k] native_write_msr_safe
0.00% 13151.543534 +000000.000007 ls [kernel.kallsyms] [k] native_write_msr_safe
0.05% 13151.543536 +000000.000009 ls [kernel.kallsyms] [k] native_write_msr_safe
0.92% 13151.543538 +000000.000011 ls [kernel.kallsyms] [k] perf_event_comm
14.52% 13151.543560 +000000.000033 ls [kernel.kallsyms] [k] uprobe_mmap
30.10% 13151.543878 +000000.000351 ls ld-2.17.so [.] _dl_setup_hash
29.30% 13151.544531 +000000.001004 ls ls [.] gobble_file.constprop.49
25.09% 13151.545613 +000000.002086 ls [kernel.kallsyms] [k] _cond_resched--- tools/perf/builtin-report.c | 6 +++++- tools/perf/util/hist.c | 3 +++ tools/perf/util/sort.c | 26 ++++++++++++++++++++++++++ tools/perf/util/sort.h | 1 + tools/perf/util/symbol.h | 3 ++- 5 files changed, 37 insertions(+), 2 deletions(-)
tools/perf/builtin-report.c +5 -1
@@ -731,7 +731,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)OPT_BOOLEAN (0 ,"source" , &symbol_conf.annotate_src,"Interleave source code with assembly code (default)" ),OPT_BOOLEAN (0 ,"asm-raw" , &symbol_conf.annotate_asm_raw, -"Display raw encoding of assembly instructions (default)" ), +"display raw encoding of assembly instructions (default)" ),OPT_STRING ('M' ,"disassembler-style" , &disassembler_style,"disassembler style" ,"Specify disassembler style (e.g. -M intel for intel syntax)" ), OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
@@ -749,6 +749,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) "Don't show entries under that percent", parse_percent_limit),OPT_CALLBACK (0 ,"percentage" ,NULL ,"relative|absolute" ,"how to display percentage of filtered entries" , parse_percentage), +OPT_BOOLEAN (0 ,"list" , &symbol_conf.show_list,"Show events list" ),OPT_END () }; struct perf_data_file file = {
@@ -891,6 +892,9 @@ repeat:sort__setup_elide (stdout); +if (symbol_conf.show_list) +sort__setup_list (); + ret =__cmd_report (&report);if (ret ==K_SWITCH_INPUT_DATA ) {perf_session__delete (session);
tools/perf/util/hist.c +3 -0
@@ -1073,6 +1073,9 @@ static int hist_entry__sort_on_period(struct hist_entry *a,struct hist_entry *pair;u64 *periods_a, *periods_b; +if (symbol_conf.show_list) +return b->idx - a->idx; +if (symbol_conf.cumulate_callchain) {/* * Put caller above callee when they have equal period.
tools/perf/util/sort.c +26 -0
@@ -1102,6 +1102,21 @@ static struct sort_dimension memory_sort_dimensions[] = {#undef DIM +static void __sort_dimension__prep (struct sort_dimension *sd, +enum sort_type idx) +{ +if (sd->taken) +return ; + +if (sd->entry->se_collapse) + sort__need_collapse =1 ; + + sort__first_dimension = idx; + +list_add (&sd->entry->list, &hist_entry__sort_list); + sd->taken =1 ; +} +static void __sort_dimension__add (struct sort_dimension *sd,enum sort_type idx) {if (sd->taken)
@@ -1271,3 +1286,14 @@ void sort__setup_elide(FILE *output)list_for_each_entry (se, &hist_entry__sort_list, list) se->elide = false; } + +void sort__setup_list (void ) +{ +struct sort_dimension *sd_idx = &common_sort_dimensions[SORT_IDX ]; +struct sort_dimension *sd_time = &common_sort_dimensions[SORT_TIME ]; + +__sort_dimension__prep (sd_time,SORT_TIME ); +__sort_dimension__prep (sd_idx,SORT_IDX ); + + sd_idx->entry->elide = true; +}
tools/perf/util/sort.h +1 -0
@@ -211,6 +211,7 @@ extern struct list_head hist_entry__sort_list;int setup_sorting (void );extern int sort_dimension__add (const char *);void sort__setup_elide (FILE *fp); +void sort__setup_list (void );int report_parse_ignore_callees_opt (const struct option *opt,const char *arg,int unset);
tools/perf/util/symbol.h +2 -1
@@ -106,7 +106,8 @@ struct symbol_conf { annotate_src, event_group, demangle, - filter_relative; + filter_relative, + show_list;const char *vmlinux_name, *kallsyms_name, *source_prefix,
Signature · 1 line
1.8.3.1
Namhyung Kim
maintainerRe: [PATCH 04/22] perf tools: Add --list report option
Quoted 14 lines · Jiri Olsa
Adding --list report option to display entries sequentialy:
$ perf report --list --stdio ... 0.00% 13151.543527 +000000.000000 ls [kernel.kallsyms] [k] native_write_msr_safe 0.00% 13151.543530 +000000.000003 ls [kernel.kallsyms] [k] native_write_msr_safe 0.00% 13151.543532 +000000.000005 ls [kernel.kallsyms] [k] native_write_msr_safe 0.00% 13151.543534 +000000.000007 ls [kernel.kallsyms] [k] native_write_msr_safe 0.05% 13151.543536 +000000.000009 ls [kernel.kallsyms] [k] native_write_msr_safe 0.92% 13151.543538 +000000.000011 ls [kernel.kallsyms] [k] perf_event_comm 14.52% 13151.543560 +000000.000033 ls [kernel.kallsyms] [k] uprobe_mmap 30.10% 13151.543878 +000000.000351 ls ld-2.17.so [.] _dl_setup_hash 29.30% 13151.544531 +000000.001004 ls ls [.] gobble_file.constprop.49 25.09% 13151.545613 +000000.002086 ls [kernel.kallsyms] [k] _cond_resched
Hmm.. it seems what this --list option does is very similar to what "perf script -f time,comm,dso,sym,ip" tries to do, no?
Thanks,
Namhyung
Re: [PATCH 04/22] perf tools: Add --list report option
Quoted 16 lines · Namhyung Kim
Quoted 14 lines · Jiri Olsa
Adding --list report option to display entries sequentialy:
$ perf report --list --stdio ... 0.00% 13151.543527 +000000.000000 ls [kernel.kallsyms] [k] native_write_msr_safe 0.00% 13151.543530 +000000.000003 ls [kernel.kallsyms] [k] native_write_msr_safe 0.00% 13151.543532 +000000.000005 ls [kernel.kallsyms] [k] native_write_msr_safe 0.00% 13151.543534 +000000.000007 ls [kernel.kallsyms] [k] native_write_msr_safe 0.05% 13151.543536 +000000.000009 ls [kernel.kallsyms] [k] native_write_msr_safe 0.92% 13151.543538 +000000.000011 ls [kernel.kallsyms] [k] perf_event_comm 14.52% 13151.543560 +000000.000033 ls [kernel.kallsyms] [k] uprobe_mmap 30.10% 13151.543878 +000000.000351 ls ld-2.17.so [.] _dl_setup_hash 29.30% 13151.544531 +000000.001004 ls ls [.] gobble_file.constprop.49 25.09% 13151.545613 +000000.002086 ls [kernel.kallsyms] [k] _cond_resched
Quoted 2 lines
Hmm.. it seems what this --list option does is very similar to what "perf script -f time,comm,dso,sym,ip" tries to do, no?
correct.. it's just byproduct which I need for lock browser I'm working on.. but this basic output seemed usefull and actually missing from report portfolio ;-)
but as I said, it's a byproduct and I can leave it for the lock change patchset
thanks,
jirka
PATCH 5/22 perf tools: Add sort_entry struct into sort entries callbacks
In reply to Jiri OlsaAdding 'struct sort_entry' to all its callback as the first parameter. This will be usefull for dynamic sort entries to get specific data.
--- tools/perf/ui/gtk/hists.c | 2 +- tools/perf/ui/hist.c | 2 +- tools/perf/util/hist.c | 7 +- tools/perf/util/sort.c | 225 +++++++++++++++++++++++++++++----------------- tools/perf/util/sort.h | 10 ++- 5 files changed, 154 insertions(+), 92 deletions(-)
tools/perf/ui/gtk/hists.c +1 -1
@@ -322,7 +322,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,if (se->elide)continue ; - se->se_snprintf (h, s,ARRAY_SIZE (s), + se->se_snprintf (se, h, s,ARRAY_SIZE (s),hists__col_len (hists, se->se_width_idx));gtk_tree_store_set (store, &iter, col_idx++, s,-1 );
tools/perf/ui/hist.c +1 -1
@@ -310,7 +310,7 @@ int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,continue ; ret +=scnprintf (s + ret, size - ret,"%s" , sep ?:" " ); - ret += se->se_snprintf (he, s + ret, size - ret, + ret += se->se_snprintf (se, he, s + ret, size - ret,hists__col_len (hists, se->se_width_idx)); }
tools/perf/util/hist.c +4 -3
@@ -916,7 +916,7 @@ hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)int64_t cmp =0 ;list_for_each_entry (se, &hist_entry__sort_list, list) { - cmp = se->se_cmp (left, right); + cmp = se->se_cmp (se, left, right);if (cmp)break ; }
@@ -931,11 +931,12 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)int64_t cmp =0 ;list_for_each_entry (se, &hist_entry__sort_list, list) { -int64_t (*f)(struct hist_entry *,struct hist_entry *); +int64_t (*f)(struct sort_entry *,struct hist_entry *, +struct hist_entry *); f = se->se_collapse ?: se->se_cmp; - cmp =f (left, right); + cmp =f (se, left, right);if (cmp)break ; }
tools/perf/util/sort.c +142 -83
562 lines not on this page · raw message
tools/perf/util/sort.h +6 -4
@@ -197,10 +197,12 @@ struct sort_entry {const char *se_header; -int64_t (*se_cmp)(struct hist_entry *,struct hist_entry *); -int64_t (*se_collapse)(struct hist_entry *,struct hist_entry *); -int (*se_snprintf)(struct hist_entry *he,char *bf,size_t size, -unsigned int width); +int64_t (*se_cmp)(struct sort_entry *,struct hist_entry *, +struct hist_entry *); +int64_t (*se_collapse)(struct sort_entry *,struct hist_entry *, +struct hist_entry *); +int (*se_snprintf)(struct sort_entry *,struct hist_entry *he, +char *bf,size_t size,unsigned int width);u8 se_width_idx;bool elide; };
Signature · 1 line
1.8.3.1
PATCH 6/22 perf tools: Add selected bool into se_snprintf sort entries callback
In reply to Jiri OlsaAdding selected bool into se_snprintf sort entries callback, so we could display selected field differently. This is going to be used for 'Time' column in following patch.
--- tools/perf/ui/gtk/hists.c | 2 +- tools/perf/ui/hist.c | 2 +- tools/perf/util/sort.c | 27 ++++++++++++++++++++++++++- tools/perf/util/sort.h | 3 ++- 4 files changed, 30 insertions(+), 4 deletions(-)
tools/perf/ui/gtk/hists.c +1 -1
@@ -322,7 +322,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,if (se->elide)continue ; - se->se_snprintf (se, h, s,ARRAY_SIZE (s), + se->se_snprintf (se, false, h, s,ARRAY_SIZE (s),hists__col_len (hists, se->se_width_idx));gtk_tree_store_set (store, &iter, col_idx++, s,-1 );
tools/perf/ui/hist.c +1 -1
@@ -310,7 +310,7 @@ int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,continue ; ret +=scnprintf (s + ret, size - ret,"%s" , sep ?:" " ); - ret += se->se_snprintf (se, he, s + ret, size - ret, + ret += se->se_snprintf (se, false, he, s + ret, size - ret,hists__col_len (hists, se->se_width_idx)); }
tools/perf/util/sort.c +26 -1
@@ -65,6 +65,7 @@ sort__idx_cmp(struct sort_entry *se __maybe_unused, }static int hist_entry__idx_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -100,6 +101,7 @@ static u64 get_time_base(struct hist_entry *he) }static int hist_entry__time_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -142,6 +144,7 @@ sort__thread_cmp(struct sort_entry *se __maybe_unused, }static int hist_entry__thread_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -176,6 +179,7 @@ sort__comm_collapse(struct sort_entry *se __maybe_unused, }static int hist_entry__comm_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -234,6 +238,7 @@ static int _hist_entry__dso_snprintf(struct sort_entry *se __maybe_unused, }static int hist_entry__dso_snprintf (struct sort_entry *se, +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -331,6 +336,7 @@ static int _hist_entry__sym_snprintf(struct sort_entry *se __maybe_unused, }static int hist_entry__sym_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -373,6 +379,7 @@ sort__srcline_cmp(struct sort_entry *se __maybe_unused, }static int hist_entry__srcline_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width__maybe_unused )
@@ -403,6 +410,7 @@ sort__parent_cmp(struct sort_entry *se __maybe_unused, }static int hist_entry__parent_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -427,6 +435,7 @@ sort__cpu_cmp(struct sort_entry *se __maybe_unused, }static int hist_entry__cpu_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -451,8 +460,9 @@ sort__dso_from_cmp(struct sort_entry *se, }static int hist_entry__dso_from_snprintf (struct sort_entry *se, +bool selected__maybe_unused ,struct hist_entry *he,char *bf, -size_t size,unsigned int width) +size_t size,unsigned int width) {return _hist_entry__dso_snprintf (se, he->branch_info->from.map, bf, size, width);
@@ -467,6 +477,7 @@ sort__dso_to_cmp(struct sort_entry *se, }static int hist_entry__dso_to_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -501,6 +512,7 @@ sort__sym_to_cmp(struct sort_entry *se, }static int hist_entry__sym_from_snprintf (struct sort_entry *se, +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -511,6 +523,7 @@ static int hist_entry__sym_from_snprintf(struct sort_entry *se, }static int hist_entry__sym_to_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -561,6 +574,7 @@ sort__mispredict_cmp(struct sort_entry *se __maybe_unused, }static int hist_entry__mispredict_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width){static const char *out ="N/A" ;
@@ -589,6 +603,7 @@ sort__daddr_cmp(struct sort_entry *se __maybe_unused, }static int hist_entry__daddr_snprintf (struct sort_entry *se, +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -621,6 +636,7 @@ sort__dso_daddr_cmp(struct sort_entry *se __maybe_unused, }static int hist_entry__dso_daddr_snprintf (struct sort_entry *se, +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -653,6 +669,7 @@ sort__locked_cmp(struct sort_entry *se __maybe_unused, }static int hist_entry__locked_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -704,6 +721,7 @@ static const char * const tlb_access[] = {#define NUM_TLB_ACCESS (sizeof(tlb_access)/sizeof(const char *))static int hist_entry__tlb_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -783,6 +801,7 @@ static const char * const mem_lvl[] = {#define NUM_MEM_LVL (sizeof(mem_lvl)/sizeof(const char *))static int hist_entry__lvl_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -853,6 +872,7 @@ static const char * const snoop_access[] = {#define NUM_SNOOP_ACCESS (sizeof(snoop_access)/sizeof(const char *))static int hist_entry__snoop_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -904,6 +924,7 @@ sort__local_weight_cmp(struct sort_entry *se __maybe_unused,static int hist_entry__local_weight_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -926,6 +947,7 @@ sort__global_weight_cmp(struct sort_entry *se __maybe_unused,static int hist_entry__global_weight_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -990,6 +1012,7 @@ sort__abort_cmp(struct sort_entry *se __maybe_unused, }static int hist_entry__abort_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -1016,6 +1039,7 @@ sort__in_tx_cmp(struct sort_entry *se __maybe_unused, }static int hist_entry__in_tx_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
@@ -1078,6 +1102,7 @@ int hist_entry__transaction_len(void)static int hist_entry__transaction_snprintf (struct sort_entry *se__maybe_unused , +bool selected__maybe_unused ,struct hist_entry *he,char *bf,size_t size,unsigned int width) {
tools/perf/util/sort.h +2 -1
@@ -201,7 +201,8 @@ struct sort_entry { struct hist_entry *);int64_t (*se_collapse)(struct sort_entry *,struct hist_entry *,struct hist_entry *); -int (*se_snprintf)(struct sort_entry *,struct hist_entry *he, +int (*se_snprintf)(struct sort_entry *,bool selected, +struct hist_entry *he,char *bf,size_t size,unsigned int width);u8 se_width_idx;bool elide;
Signature · 1 line
1.8.3.1
PATCH 7/22 perf tools: Implement selected bool se_snprintf callback logic
In reply to Jiri OlsaPass the selected info for TUI browser.
--- tools/perf/ui/browsers/hists.c | 5 +++-- tools/perf/ui/hist.c | 5 +++-- tools/perf/ui/stdio/hist.c | 2 +- tools/perf/util/hist.h | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-)
tools/perf/ui/browsers/hists.c +3 -2
@@ -790,7 +790,8 @@ static int hist_browser__show_entry(struct hist_browser *browser,if (!browser->b.navkeypressed) width +=1 ; -hist_entry__sort_snprintf (entry, s,sizeof (s), browser->hists); +hist_entry__sort_snprintf (entry, current_entry, s,sizeof (s), + browser->hists);slsmg_write_nstring (s, width); ++row; ++printed;
@@ -1124,7 +1125,7 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser,if (symbol_conf.use_callchain) folded_sign =hist_entry__folded (he); -hist_entry__sort_snprintf (he, s,sizeof (s), browser->hists); +hist_entry__sort_snprintf (he, false, s,sizeof (s), browser->hists); percent = (he->stat.period *100.0 ) / browser->hists->stats.total_period;if (symbol_conf.use_callchain)
tools/perf/ui/hist.c +3 -2
@@ -298,7 +298,8 @@ void perf_hpp__cancel_cumulate(void) perf_hpp__format[PERF_HPP__OVERHEAD ].header = hpp__header_overhead; } -int hist_entry__sort_snprintf (struct hist_entry *he,char *s,size_t size, +int hist_entry__sort_snprintf (struct hist_entry *he,bool selected, +char *s,size_t size,struct hists *hists) {const char *sep = symbol_conf.field_sep;
@@ -310,7 +311,7 @@ int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,continue ; ret +=scnprintf (s + ret, size - ret,"%s" , sep ?:" " ); - ret += se->se_snprintf (se, false, he, s + ret, size - ret, + ret += se->se_snprintf (se, selected, he, s + ret, size - ret,hists__col_len (hists, se->se_width_idx)); }
tools/perf/ui/stdio/hist.c +1 -1
@@ -360,7 +360,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, size = hpp.size = bfsz; ret =hist_entry__period_snprintf (&hpp, he); -hist_entry__sort_snprintf (he, bf + ret, size - ret, hists); +hist_entry__sort_snprintf (he, false, bf + ret, size - ret, hists); ret =fprintf (fp,"%s\n" , bf);
tools/perf/util/hist.h +2 -1
@@ -143,7 +143,8 @@ int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al,int64_t hist_entry__cmp (struct hist_entry *left,struct hist_entry *right);int64_t hist_entry__collapse (struct hist_entry *left,struct hist_entry *right);int hist_entry__transaction_len (void ); -int hist_entry__sort_snprintf (struct hist_entry *he,char *bf,size_t size, +int hist_entry__sort_snprintf (struct hist_entry *he,bool selected, +char *bf,size_t size,struct hists *hists);void hist_entry__free (struct hist_entry *);
Signature · 1 line
1.8.3.1
PATCH 8/22 perf tools: Implement selected logic for time sort entry
In reply to Jiri OlsaDisplay delta time from the selected entry. Implemented only for the TUI browser.
--- tools/perf/ui/browsers/hists.c | 13 +++++++++++++ tools/perf/util/sort.c | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-)
tools/perf/ui/browsers/hists.c +13 -0
@@ -27,6 +27,7 @@ struct hist_browser {bool show_dso;float min_pcnt;u64 nr_pcnt_entries; +u64 time_base; };extern void hist_browser__init_hpp (void );
@@ -819,12 +820,24 @@ static void ui_browser__hists_init_top(struct ui_browser *browser) } } +static void init_time_base (struct hist_browser *hb) +{ +struct hists *hists = hb->hists; + +if (hb->time_base) + hists->time_base = hb->time_base; + +if (hists->time_base && !hb->time_base) + hb->time_base = hists->time_base; +} +static unsigned int hist_browser__refresh (struct ui_browser *browser) {unsigned row =0 ;struct rb_node *nd; struct hist_browser *hb = container_of(browser, struct hist_browser, b); +init_time_base (hb);ui_browser__hists_init_top (browser);for (nd = browser->top; nd; nd =rb_next (nd)) {
tools/perf/util/sort.c +3 -3
@@ -90,11 +90,11 @@ sort__time_cmp(struct sort_entry *se __maybe_unused,return right->time - left->time; } -static u64 get_time_base (struct hist_entry *he) +static u64 get_time_base (struct hist_entry *he,bool selected) {struct hists *hists = he->hists; -if (!hists->time_base) +if (!hists->time_base || selected) hists->time_base = he->time;return hists->time_base;
@@ -106,7 +106,7 @@ static int hist_entry__time_snprintf(struct sort_entry *se __maybe_unused, size_t size, unsigned int width) { char buf[100]; -u64 time_base =get_time_base (he); +u64 time_base =get_time_base (he, selected);unsigned long time_sec, time_usec;unsigned long base_sec, base_usec;long delta_sec, delta_usec;
Signature · 1 line
1.8.3.1
PATCH 9/22 perf tools: Factor ui_browser ops out of ui_browser struct
In reply to Jiri OlsaSeparating ops out of 'struct ui_browser' into 'struct ui_browser_ops'.
--- tools/perf/ui/browser.c | 37 ++++++++++++++++++++++--------------- tools/perf/ui/browser.h | 28 +++++++++++++++++----------- tools/perf/ui/browsers/annotate.c | 19 +++++++++++-------- tools/perf/ui/browsers/header.c | 8 +++++--- tools/perf/ui/browsers/hists.c | 14 ++++++++------ tools/perf/ui/browsers/map.c | 8 +++++--- tools/perf/ui/browsers/scripts.c | 2 +- tools/perf/ui/tui/util.c | 8 +++++--- 8 files changed, 74 insertions(+), 50 deletions(-)
tools/perf/ui/browser.c +22 -15
@@ -46,12 +46,18 @@ void ui_browser__gotorc(struct ui_browser *browser, int y, int x)SLsmg_gotorc (browser->y + y, browser->x + x); } +static bool ui_browser__filter (struct ui_browser *browser,void *entry) +{ +return browser->ops.filter ? browser->ops.filter (browser, entry) : + false; +} +static struct list_head *ui_browser__list_head_filter_entries (struct ui_browser *browser,struct list_head *pos) {do { -if (!browser->filter || !browser->filter (browser, pos)) +if (!ui_browser__filter (browser, pos))return pos; pos = pos->next; }while (pos != browser->entries);
@@ -64,7 +70,7 @@ ui_browser__list_head_filter_prev_entries(struct ui_browser *browser, struct list_head *pos) {do { -if (!browser->filter || !browser->filter (browser, pos)) +if (!ui_browser__filter (browser, pos))return pos; pos = pos->prev; }while (pos != browser->entries);
@@ -149,7 +155,7 @@ unsigned int ui_browser__rb_tree_refresh(struct ui_browser *browser)while (nd !=NULL ) {ui_browser__gotorc (browser, row,0 ); - browser->write (browser, nd, row); + browser->ops.write (browser, nd, row);if (++row == browser->height)break ; nd =rb_next (nd);
@@ -227,7 +233,7 @@ bool ui_browser__dialog_yesno(struct ui_browser *browser, const char *text)void ui_browser__reset_index (struct ui_browser *browser) { browser->index = browser->top_idx =0 ; - browser->seek (browser,0 ,SEEK_SET ); + browser->ops.seek (browser,0 ,SEEK_SET ); }void __ui_browser__show_title (struct ui_browser *browser,const char *title)
@@ -302,7 +308,7 @@ static int __ui_browser__refresh(struct ui_browser *browser)int row;int width = browser->width; - row = browser->refresh (browser); + row = browser->ops.refresh (browser);ui_browser__set_color (browser,HE_COLORSET_NORMAL );if (!browser->use_navkeypressed || browser->navkeypressed)
@@ -346,11 +352,12 @@ void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries) } browser->top =NULL ; - browser->seek (browser, browser->top_idx,SEEK_SET ); + browser->ops.seek (browser, browser->top_idx,SEEK_SET ); }int ui_browser__run (struct ui_browser *browser,int delay_secs) { +struct ui_browser_ops *ops = &browser->ops;int err, key;while (1 ) {
@@ -391,7 +398,7 @@ int ui_browser__run(struct ui_browser *browser, int delay_secs) ++browser->index;if (browser->index == browser->top_idx + browser->height) { ++browser->top_idx; - browser->seek (browser,+1 ,SEEK_CUR ); + ops->seek (browser,+1 ,SEEK_CUR ); }break ;case K_UP :
@@ -400,7 +407,7 @@ int ui_browser__run(struct ui_browser *browser, int delay_secs) --browser->index;if (browser->index < browser->top_idx) { --browser->top_idx; - browser->seek (browser,-1 ,SEEK_CUR ); + ops->seek (browser,-1 ,SEEK_CUR ); }break ;case K_PGDN :
@@ -413,7 +420,7 @@ int ui_browser__run(struct ui_browser *browser, int delay_secs) offset = browser->nr_entries -1 - browser->index; browser->index += offset; browser->top_idx += offset; - browser->seek (browser, +offset,SEEK_CUR ); + ops->seek (browser, +offset,SEEK_CUR );break ;case K_PGUP :if (browser->top_idx ==0 )
@@ -426,7 +433,7 @@ int ui_browser__run(struct ui_browser *browser, int delay_secs) browser->index -= offset; browser->top_idx -= offset; - browser->seek (browser, -offset,SEEK_CUR ); + ops->seek (browser, -offset,SEEK_CUR );break ;case K_HOME :ui_browser__reset_index (browser);
@@ -438,7 +445,7 @@ int ui_browser__run(struct ui_browser *browser, int delay_secs) browser->index = browser->nr_entries -1 ; browser->top_idx = browser->index - offset; - browser->seek (browser, -offset,SEEK_END ); + ops->seek (browser, -offset,SEEK_END );break ;default :return key;
@@ -459,9 +466,9 @@ unsigned int ui_browser__list_head_refresh(struct ui_browser *browser) pos = browser->top;list_for_each_from (pos, head) { -if (!browser->filter || !browser->filter (browser, pos)) { +if (!ui_browser__filter (browser, pos)) {ui_browser__gotorc (browser, row,0 ); - browser->write (browser, pos, row); + browser->ops.write (browser, pos, row);if (++row == browser->height)break ; }
@@ -584,9 +591,9 @@ unsigned int ui_browser__argv_refresh(struct ui_browser *browser) pos = (char **)browser->top;while (idx < browser->nr_entries) { -if (!browser->filter || !browser->filter (browser, *pos)) { +if (!ui_browser__filter (browser, *pos)) {ui_browser__gotorc (browser, row,0 ); - browser->write (browser, pos, row); + browser->ops.write (browser, pos, row);if (++row == browser->height)break ; }
tools/perf/ui/browser.h +17 -11
@@ -13,21 +13,27 @@#define HE_COLORSET_ADDR 55#define HE_COLORSET_ROOT 56 -struct ui_browser { -u64 index, top_idx; -void *top, *entries; -u16 y, x, width, height; -int current_color; -void *priv; -const char *title; -char *helpline; +struct ui_browser ; + +struct ui_browser_ops {unsigned int (*refresh)(struct ui_browser *browser);void (*write)(struct ui_browser *browser,void *entry,int row);void (*seek)(struct ui_browser *browser,off_t offset,int whence);bool (*filter)(struct ui_browser *browser,void *entry); -u32 nr_entries; -bool navkeypressed; -bool use_navkeypressed; +}; + +struct ui_browser { +u64 index, top_idx; +void *top, *entries; +u16 y, x, width, height; +int current_color; +void *priv; +const char *title; +char *helpline; +u32 nr_entries; +bool navkeypressed; +bool use_navkeypressed; +struct ui_browser_ops ops; };int ui_browser__set_color (struct ui_browser *browser,int color);
tools/perf/ui/browsers/annotate.c +11 -8
@@ -388,8 +388,9 @@ static bool annotate_browser__toggle_source(struct annotate_browser *browser)struct disasm_line *dl;struct browser_disasm_line *bdl;off_t offset = browser->b.index - browser->b.top_idx; +struct ui_browser_ops *ops = &browser->b.ops; - browser->b.seek (&browser->b, offset,SEEK_CUR ); + ops->seek (&browser->b, offset,SEEK_CUR ); dl = list_entry(browser->b.top, struct disasm_line, node); bdl =disasm_line__browser (dl);
@@ -399,13 +400,13 @@ static bool annotate_browser__toggle_source(struct annotate_browser *browser) browser->b.nr_entries = browser->nr_entries; annotate_browser__opts.hide_src_code = false; - browser->b.seek (&browser->b, -offset,SEEK_CUR ); + ops->seek (&browser->b, -offset,SEEK_CUR ); browser->b.top_idx = bdl->idx - offset; browser->b.index = bdl->idx; }else {if (bdl->idx_asm <0 ) {ui_helpline__puts ("Only available for assembly lines." ); - browser->b.seek (&browser->b, -offset,SEEK_CUR ); + ops->seek (&browser->b, -offset,SEEK_CUR );return false; }
@@ -414,7 +415,7 @@ static bool annotate_browser__toggle_source(struct annotate_browser *browser) browser->b.nr_entries = browser->nr_asm_entries; annotate_browser__opts.hide_src_code = true; - browser->b.seek (&browser->b, -offset,SEEK_CUR ); + ops->seek (&browser->b, -offset,SEEK_CUR ); browser->b.top_idx = bdl->idx_asm - offset; browser->b.index = bdl->idx_asm; }
@@ -882,10 +883,12 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, };struct annotate_browser browser = { .b = { - .refresh = annotate_browser__refresh, - .seek = ui_browser__list_head_seek, - .write = annotate_browser__write, - .filter = disasm_line__filter, + .ops = { + .refresh = annotate_browser__refresh, + .seek = ui_browser__list_head_seek, + .write = annotate_browser__write, + .filter = disasm_line__filter, + }, .priv = &ms, .use_navkeypressed = true, },
tools/perf/ui/browsers/header.c +5 -3
@@ -81,10 +81,12 @@ static int ui__list_menu(int argc, char * const argv[]) {struct ui_browser menu = { .entries = (void *)argv, - .refresh = ui_browser__argv_refresh, - .seek = ui_browser__argv_seek, - .write = ui_browser__argv_write, .nr_entries = argc, + .ops = { + .refresh = ui_browser__argv_refresh, + .seek = ui_browser__argv_seek, + .write = ui_browser__argv_write, + }, };return list_menu__run (&menu);
tools/perf/ui/browsers/hists.c +8 -6
@@ -1216,8 +1216,8 @@ static struct hist_browser *hist_browser__new(struct hists *hists)if (browser) { browser->hists = hists; - browser->b.refresh = hist_browser__refresh; - browser->b.seek = ui_browser__hists_seek; + browser->b.ops.refresh = hist_browser__refresh; + browser->b.ops.seek = ui_browser__hists_seek; browser->b.use_navkeypressed = true; }
@@ -1944,11 +1944,13 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist,struct perf_evsel *pos;struct perf_evsel_menu menu = { .b = { + .ops = { + .refresh = ui_browser__list_head_refresh, + .seek = ui_browser__list_head_seek, + .write = perf_evsel_menu__write, + .filter = filter_group_entries, + }, .entries = &evlist->entries, - .refresh = ui_browser__list_head_refresh, - .seek = ui_browser__list_head_seek, - .write = perf_evsel_menu__write, - .filter = filter_group_entries, .nr_entries = nr_entries, .priv = evlist, },
tools/perf/ui/browsers/map.c +5 -3
@@ -103,9 +103,11 @@ int map__browse(struct map *map)struct map_browser mb = { .b = { .entries = &map->dso->symbols[map->type], - .refresh = ui_browser__rb_tree_refresh, - .seek = ui_browser__rb_tree_seek, - .write = map_browser__write, + .ops = { + .refresh = ui_browser__rb_tree_refresh, + .seek = ui_browser__rb_tree_seek, + .write = map_browser__write, + }, }, .map = map, };
tools/perf/ui/browsers/scripts.c +1 -1
@@ -116,7 +116,7 @@ int script_browse(const char *script_opt)struct script_line *sline;struct perf_script_browser script = { - .b = { + .b.ops = { .refresh = ui_browser__list_head_refresh, .seek = ui_browser__list_head_seek, .write = script_browser__write,
tools/perf/ui/tui/util.c +5 -3
@@ -60,10 +60,12 @@ int ui__popup_menu(int argc, char * const argv[]) {struct ui_browser menu = { .entries = (void *)argv, - .refresh = ui_browser__argv_refresh, - .seek = ui_browser__argv_seek, - .write = ui_browser__argv_write, .nr_entries = argc, + .ops = { + .refresh = ui_browser__argv_refresh, + .seek = ui_browser__argv_seek, + .write = ui_browser__argv_write, + }, };return popup_menu__run (&menu);
Signature · 1 line
1.8.3.1
PATCH 10/22 perf tools: Add header callback into ui_browser_ops struct
In reply to Jiri OlsaAdding header callback into 'struct ui_browser_ops', the prototype is:
unsigned int (*header)(struct ui_browser *browser);
It's called before the refresh callback under the same lock. It's going to be used for hist browser to display column header.
--- tools/perf/ui/browser.c | 8 ++++++++ tools/perf/ui/browser.h | 1 + 2 files changed, 9 insertions(+)
tools/perf/ui/browser.c +8 -0
@@ -303,11 +303,19 @@ static void ui_browser__scrollbar_set(struct ui_browser *browser)SLsmg_set_char_set (0 ); } +static void __ui_browser__header (struct ui_browser *browser) +{ +if (browser->ops.header) + browser->ops.header (browser); +} +static int __ui_browser__refresh (struct ui_browser *browser) {int row;int width = browser->width; +__ui_browser__header (browser); + row = browser->ops.refresh (browser);ui_browser__set_color (browser,HE_COLORSET_NORMAL );
tools/perf/ui/browser.h +1 -0
@@ -16,6 +16,7 @@struct ui_browser ;struct ui_browser_ops { +unsigned int (*header)(struct ui_browser *browser);unsigned int (*refresh)(struct ui_browser *browser);void (*write)(struct ui_browser *browser,void *entry,int row);void (*seek)(struct ui_browser *browser,off_t offset,int whence);
Signature · 1 line
1.8.3.1
PATCH 11/22 perf tools: Remove ev_name argument from perf_evsel__hists_browse
In reply to Jiri OlsaRemoving ev_name argument from perf_evsel__hists_browse function, because it's not needed. We can get the name out of the 'struct perf_evsel' which is passed as argument as well.
--- tools/perf/ui/browsers/hists.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
tools/perf/ui/browsers/hists.c +11 -14
@@ -32,8 +32,7 @@ struct hist_browser {extern void hist_browser__init_hpp (void ); -static int hists__browser_title (struct hists *hists,char *bf,size_t size, -const char *ev_name); +static int hists__browser_title (struct hists *hists,char *bf,size_t size);static void hist_browser__refresh_dimensions (struct hist_browser *browser) {
@@ -313,7 +312,7 @@ static void ui_browser__warn_lost_events(struct ui_browser *browser)static void hist_browser__update_pcnt_entries (struct hist_browser *hb); -static int hist_browser__run (struct hist_browser *browser,const char *ev_name, +static int hist_browser__run (struct hist_browser *browser,struct hist_browser_timer *hbt) {int key;
@@ -326,7 +325,7 @@ static int hist_browser__run(struct hist_browser *browser, const char *ev_name, browser->b.nr_entries = browser->nr_pcnt_entries;hist_browser__refresh_dimensions (browser); -hists__browser_title (browser->hists, title,sizeof (title), ev_name); +hists__browser_title (browser->hists, title,sizeof (title));if (ui_browser__show (&browser->b, title,"Press '?' for help on key bindings" ) <0 )
@@ -356,7 +355,7 @@ static int hist_browser__run(struct hist_browser *browser, const char *ev_name,ui_browser__warn_lost_events (&browser->b); } -hists__browser_title (browser->hists, title,sizeof (title), ev_name); +hists__browser_title (browser->hists, title,sizeof (title));ui_browser__show_title (&browser->b, title);continue ; }
@@ -1239,8 +1238,7 @@ static struct thread *hist_browser__selected_thread(struct hist_browser *browserreturn browser->he_selection->thread; } -static int hists__browser_title (struct hists *hists,char *bf,size_t size, -const char *ev_name) +static int hists__browser_title (struct hists *hists,char *bf,size_t size) {char unit;int printed;
@@ -1249,6 +1247,7 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size,unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE ];u64 nr_events = hists->stats.total_period;struct perf_evsel *evsel =hists_to_evsel (hists); +const char *ev_name =perf_evsel__name (evsel);char buf[512 ];size_t buflen =sizeof (buf);
@@ -1401,7 +1400,7 @@ static void hist_browser__update_pcnt_entries(struct hist_browser *hb) } static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, - const char *helpline, const char *ev_name, + const char *helpline, bool left_exits, struct hist_browser_timer *hbt, float min_pcnt,
@@ -1475,7 +1474,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, nr_options =0 ; - key =hist_browser__run (browser, ev_name, hbt); + key =hist_browser__run (browser, hbt);if (browser->he_selection !=NULL ) { thread =hist_browser__selected_thread (browser);
@@ -1840,7 +1839,7 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, {struct perf_evlist *evlist = menu->b.priv;struct perf_evsel *pos; -const char *ev_name, *title ="Available samples" ; +const char *title ="Available samples" ;int delay_secs = hbt ? hbt->refresh :0 ;int key;
@@ -1873,9 +1872,8 @@ browse_hists:*/ if (hbt) hbt->timer (hbt->arg); - ev_name =perf_evsel__name (pos); key =perf_evsel__hists_browse (pos, nr_events, help, - ev_name, true, hbt, + true, hbt, menu->min_pcnt, menu->env);ui_browser__show_title (&menu->b, title);
@@ -1981,10 +1979,9 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, single_entry:if (nr_entries ==1 ) {struct perf_evsel *first =perf_evlist__first (evlist); -const char *ev_name =perf_evsel__name (first);return perf_evsel__hists_browse (first, nr_entries, help, - ev_name, false, hbt, min_pcnt, + false, hbt, min_pcnt, env); }
Signature · 1 line
1.8.3.1
PATCH 12/22 perf tools: Add header callback to hist browser
In reply to Jiri OlsaAdding header callback for hist browser to display the column headers.
--- tools/perf/ui/browser.c | 46 ++++++++++++++++++++++++++++++++---------- tools/perf/ui/browser.h | 2 ++ tools/perf/ui/browsers/hists.c | 25 +++++++++++++++-------- 3 files changed, 54 insertions(+), 19 deletions(-)
tools/perf/ui/browser.c +35 -11
@@ -250,26 +250,49 @@ void ui_browser__show_title(struct ui_browser *browser, const char *title)pthread_mutex_unlock (&ui__lock); } -int ui_browser__show (struct ui_browser *browser,const char *title, -const char *helpline, ...) +static int ui_browser__show_va (struct ui_browser *browser,const char *title, +const char *helpline,va_list args) {int err; -va_list ap; - -ui_browser__refresh_dimensions (browser); -pthread_mutex_lock (&ui__lock);__ui_browser__show_title (browser, title); browser->title = title;zfree (&browser->helpline); -va_start (ap, helpline); - err =vasprintf (&browser->helpline, helpline, ap); -va_end (ap); + err =vasprintf (&browser->helpline, helpline, args);if (err >0 )ui_helpline__push (browser->helpline); + +return err; +} + +int __ui_browser__show (struct ui_browser *browser,const char *title, +const char *helpline, ...) +{ +va_list args; +int err; + +va_start (args, helpline); + err =ui_browser__show_va (browser, title, helpline, args); +va_end (args); + +return err ?0 :-1 ; +} + +int ui_browser__show (struct ui_browser *browser,const char *title, +const char *helpline, ...) +{ +va_list args; +int err; + +pthread_mutex_lock (&ui__lock); +ui_browser__refresh_dimensions (browser); +va_start (args, helpline); + err =ui_browser__show_va (browser, title, helpline, args); +va_end (args);pthread_mutex_unlock (&ui__lock); +return err ?0 :-1 ; }
@@ -311,14 +334,15 @@ static void __ui_browser__header(struct ui_browser *browser)static int __ui_browser__refresh (struct ui_browser *browser) { -int row; -int width = browser->width; +int row, width;__ui_browser__header (browser); row = browser->ops.refresh (browser);ui_browser__set_color (browser,HE_COLORSET_NORMAL ); + width = browser->width; +if (!browser->use_navkeypressed || browser->navkeypressed)ui_browser__scrollbar_set (browser);else
tools/perf/ui/browser.h +2 -0
@@ -50,6 +50,8 @@ void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column, u64 start, u64 end);void __ui_browser__show_title (struct ui_browser *browser,const char *title);void ui_browser__show_title (struct ui_browser *browser,const char *title); +int __ui_browser__show (struct ui_browser *browser,const char *title, +const char *helpline, ...);int ui_browser__show (struct ui_browser *browser,const char *title,const char *helpline, ...);void ui_browser__hide (struct ui_browser *browser);
tools/perf/ui/browsers/hists.c +17 -8
@@ -316,7 +316,6 @@ static int hist_browser__run(struct hist_browser *browser, struct hist_browser_timer *hbt) {int key; -char title[160 ];int delay_secs = hbt ? hbt->refresh :0 ; browser->b.entries = &browser->hists->entries;
@@ -325,11 +324,6 @@ static int hist_browser__run(struct hist_browser *browser, browser->b.nr_entries = browser->nr_pcnt_entries;hist_browser__refresh_dimensions (browser); -hists__browser_title (browser->hists, title,sizeof (title)); - -if (ui_browser__show (&browser->b, title, -"Press '?' for help on key bindings" ) <0 ) -return -1 ;while (1 ) { key =ui_browser__run (&browser->b, delay_secs);
@@ -355,8 +349,6 @@ static int hist_browser__run(struct hist_browser *browser,ui_browser__warn_lost_events (&browser->b); } -hists__browser_title (browser->hists, title,sizeof (title)); -ui_browser__show_title (&browser->b, title);continue ; }case 'D' : {/* Debug */
@@ -1209,12 +1201,29 @@ static int hist_browser__dump(struct hist_browser *browser)return 0 ; } +static unsigned int hist_browser__header (struct ui_browser *b) +{ +struct hist_browser *browser; +char title[160 ]; + + browser = container_of(b, struct hist_browser, b); +ui_browser__refresh_dimensions (b); +hists__browser_title (browser->hists, title,sizeof (title)); + +if (__ui_browser__show (b, title, +"Press '?' for help on key bindings" ) <0 ) +return -1 ; + +return 0 ; +} +static struct hist_browser *hist_browser__new (struct hists *hists) {struct hist_browser *browser =zalloc (sizeof (*browser));if (browser) { browser->hists = hists; + browser->b.ops.header = hist_browser__header; browser->b.ops.refresh = hist_browser__refresh; browser->b.ops.seek = ui_browser__hists_seek; browser->b.use_navkeypressed = true;
Signature · 1 line
1.8.3.1
PATCH 13/22 perf tools: Factor hpp_arg struct to carry hist_browser
In reply to Jiri OlsaThe hpp_arg struct is used within the hist browser specific code, so it could pass the hist_browser struct itself.
We'll need access to hist browser struct within __hpp__color_fmt function in following patch.
--- tools/perf/ui/browsers/hists.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
tools/perf/ui/browsers/hists.c +8 -8
@@ -574,7 +574,7 @@ static int hist_browser__show_callchain(struct hist_browser *browser, }struct hpp_arg { -struct ui_browser *b; +struct hist_browser *hb;char folded_sign;bool current_entry; };
@@ -600,7 +600,7 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he,if (hists->stats.total_period) percent =100.0 *get_field (he) / hists->stats.total_period; -ui_browser__set_percent_color (arg->b, percent, arg->current_entry); +ui_browser__set_percent_color (&arg->hb->b, percent, arg->current_entry);if (callchain_cb) ret +=callchain_cb (arg);
@@ -634,7 +634,7 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he,* zero-fill group members in the middle which * have no sample */ -ui_browser__set_percent_color (arg->b,0.0 , +ui_browser__set_percent_color (&arg->hb->b,0.0 , arg->current_entry); ret +=scnprintf (hpp->buf, hpp->size," %6.2f%%" ,0.0 );
@@ -642,7 +642,7 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he, } percent =100.0 * period / total; -ui_browser__set_percent_color (arg->b, percent, +ui_browser__set_percent_color (&arg->hb->b, percent, arg->current_entry); ret +=scnprintf (hpp->buf, hpp->size," %6.2f%%" , percent);
@@ -657,7 +657,7 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he,/* * zero-fill group members at last which have no sample */ -ui_browser__set_percent_color (arg->b,0.0 , +ui_browser__set_percent_color (&arg->hb->b,0.0 , arg->current_entry); ret +=scnprintf (hpp->buf, hpp->size," %6.2f%%" ,0.0 );
@@ -665,8 +665,8 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he, } } out: -if (!arg->current_entry || !arg->b->navkeypressed) -ui_browser__set_color (arg->b,HE_COLORSET_NORMAL ); +if (!arg->current_entry || !arg->hb->b.navkeypressed) +ui_browser__set_color (&arg->hb->b,HE_COLORSET_NORMAL );return ret; }
@@ -751,7 +751,7 @@ static int hist_browser__show_entry(struct hist_browser *browser,if (row_offset ==0 ) {struct hpp_arg arg = { - .b = &browser->b, + .hb = browser, .folded_sign = folded_sign, .current_entry = current_entry, };
Signature · 1 line
1.8.3.1
PATCH 14/22 perf tools tui: Display columns header text on 'H' press
In reply to Jiri OlsaDisplaing columns header text whenever 'H' is pressed, and hiding it on on another press.
--- tools/perf/ui/browser.c | 12 ++++++- tools/perf/ui/browser.h | 2 +- tools/perf/ui/browsers/hists.c | 78 ++++++++++++++++++++++++++++++++++++++---- 3 files changed, 84 insertions(+), 8 deletions(-)
tools/perf/ui/browser.c +11 -1
@@ -243,6 +243,13 @@ void __ui_browser__show_title(struct ui_browser *browser, const char *title)slsmg_write_nstring (title, browser->width +1 ); } +static void __ui_browser__show_header (struct ui_browser *browser,char *header) +{ +SLsmg_gotorc (1 ,0 ); +ui_browser__set_color (browser,HE_COLORSET_ROOT ); +slsmg_write_nstring (header, browser->width +1 ); +} +void ui_browser__show_title (struct ui_browser *browser,const char *title) {pthread_mutex_lock (&ui__lock);
@@ -268,7 +275,7 @@ static int ui_browser__show_va(struct ui_browser *browser, const char *title, }int __ui_browser__show (struct ui_browser *browser,const char *title, -const char *helpline, ...) +char *header,const char *helpline, ...) {va_list args;int err;
@@ -277,6 +284,9 @@ int __ui_browser__show(struct ui_browser *browser, const char *title, err =ui_browser__show_va (browser, title, helpline, args);va_end (args); +if (header) +__ui_browser__show_header (browser, header); +return err ?0 :-1 ; }
tools/perf/ui/browser.h +1 -1
@@ -51,7 +51,7 @@ void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column,void __ui_browser__show_title (struct ui_browser *browser,const char *title);void ui_browser__show_title (struct ui_browser *browser,const char *title);int __ui_browser__show (struct ui_browser *browser,const char *title, -const char *helpline, ...); +char *header,const char *helpline, ...);int ui_browser__show (struct ui_browser *browser,const char *title,const char *helpline, ...);void ui_browser__hide (struct ui_browser *browser);
tools/perf/ui/browsers/hists.c +72 -6
124 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 15/22 tools lib traceevent: Factor print_event_fields function
In reply to Jiri OlsaFactoring print_event_fields function and adding pevent_field_info function that is used later in comming patches.
--- tools/lib/traceevent/event-parse.c | 126 ++++++++++++++++++++----------------- tools/lib/traceevent/event-parse.h | 4 ++ 2 files changed, 71 insertions(+), 59 deletions(-)
tools/lib/traceevent/event-parse.c +67 -59
@@ -4026,73 +4026,81 @@ static int is_printable_array(char *p, unsigned int len)return 1 ; } -static void print_event_fields (struct trace_seq *s,void *data, -int size__maybe_unused , -struct event_format *event) +void pevent_field_info (struct trace_seq *s, +struct format_field *field, +void *data,int size__maybe_unused ) { -struct format_field *field; -unsigned long long val; +struct event_format *event = field->event;unsigned int offset, len, i; +unsigned long long val; - field = event->format.fields; -while (field) { -trace_seq_printf (s," %s=" , field->name); -if (field->flags &FIELD_IS_ARRAY ) { - offset = field->offset; - len = field->size; -if (field->flags &FIELD_IS_DYNAMIC ) { - val =pevent_read_number (event->pevent, data + offset, len); - offset = val; - len = offset >>16 ; - offset &=0xffff ; - } -if (field->flags &FIELD_IS_STRING && -is_printable_array (data + offset, len)) { -trace_seq_printf (s,"%s" , (char *)data + offset); - }else { -trace_seq_puts (s,"ARRAY[" ); -for (i =0 ; i < len; i++) { -if (i) -trace_seq_puts (s,", " ); -trace_seq_printf (s,"%02x" , - *((unsigned char *)data + offset + i)); - } -trace_seq_putc (s,']' ); - field->flags &= ~FIELD_IS_STRING ; - } +trace_seq_printf (s," %s=" , field->name); +if (field->flags &FIELD_IS_ARRAY ) { + offset = field->offset; + len = field->size; +if (field->flags &FIELD_IS_DYNAMIC ) { + val =pevent_read_number (event->pevent, data + offset, len); + offset = val; + len = offset >>16 ; + offset &=0xffff ; + } +if (field->flags &FIELD_IS_STRING && +is_printable_array (data + offset, len)) { +trace_seq_printf (s,"%s" , (char *)data + offset); }else { - val =pevent_read_number (event->pevent, data + field->offset, - field->size); -if (field->flags &FIELD_IS_POINTER ) { -trace_seq_printf (s,"0x%llx" , val); - }else if (field->flags &FIELD_IS_SIGNED ) { -switch (field->size) { -case 4 : -/* -* If field is long then print it in hex. -* A long usually stores pointers. -*/ -if (field->flags &FIELD_IS_LONG ) -trace_seq_printf (s,"0x%x" , (int )val); -else -trace_seq_printf (s,"%d" , (int )val); -break ; -case 2 : -trace_seq_printf (s,"%2d" , (short )val); -break ; -case 1 : -trace_seq_printf (s,"%1d" , (char )val); -break ; -default : -trace_seq_printf (s,"%lld" , val); - } - }else { +trace_seq_puts (s,"ARRAY[" ); +for (i =0 ; i < len; i++) { +if (i) +trace_seq_puts (s,", " ); +trace_seq_printf (s,"%02x" , + *((unsigned char *)data + offset + i)); + } +trace_seq_putc (s,']' ); + field->flags &= ~FIELD_IS_STRING ; + } + }else { + val =pevent_read_number (event->pevent, data + field->offset, + field->size); +if (field->flags &FIELD_IS_POINTER ) { +trace_seq_printf (s,"0x%llx" , val); + }else if (field->flags &FIELD_IS_SIGNED ) { +switch (field->size) { +case 4 : +/* +* If field is long then print it in hex. +* A long usually stores pointers. +*/ if (field->flags &FIELD_IS_LONG ) -trace_seq_printf (s,"0x%llx" , val); +trace_seq_printf (s,"0x%x" , (int )val);else -trace_seq_printf (s,"%llu" , val); +trace_seq_printf (s,"%d" , (int )val); +break ; +case 2 : +trace_seq_printf (s,"%2d" , (short )val); +break ; +case 1 : +trace_seq_printf (s,"%1d" , (char )val); +break ; +default : +trace_seq_printf (s,"%lld" , val); } + }else { +if (field->flags &FIELD_IS_LONG ) +trace_seq_printf (s,"0x%llx" , val); +else +trace_seq_printf (s,"%llu" , val); } + } +} + +static void print_event_fields (struct trace_seq *s,void *data,int size, +struct event_format *event) +{ +struct format_field *field; + + field = event->format.fields; +while (field) { +pevent_field_info (s, field, data, size); field = field->next; } }
tools/lib/traceevent/event-parse.h +4 -0
@@ -588,6 +588,10 @@ int pevent_pid_is_registered(struct pevent *pevent, int pid);void pevent_print_event (struct pevent *pevent,struct trace_seq *s,struct pevent_record *record,bool use_trace_clock); +void pevent_field_info (struct trace_seq *s, +struct format_field *field, +void *data,int size); +int pevent_parse_header_page (struct pevent *pevent,char *buf,unsigned long size,int long_size);
Signature · 1 line
1.8.3.1
PATCH 16/22 tools lib traceevent: Make the name output optional in pevent_field_info
In reply to Jiri OlsaMaking the name output optional in pevent_field_info function.
--- tools/lib/traceevent/event-parse.c | 9 ++++++--- tools/lib/traceevent/event-parse.h | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-)
tools/lib/traceevent/event-parse.c +6 -3
@@ -4028,13 +4028,16 @@ static int is_printable_array(char *p, unsigned int len)void pevent_field_info (struct trace_seq *s,struct format_field *field, -void *data,int size__maybe_unused ) +void *data,int size__maybe_unused , +bool print_name) {struct event_format *event = field->event;unsigned int offset, len, i;unsigned long long val; -trace_seq_printf (s," %s=" , field->name); +if (print_name) +trace_seq_printf (s," %s=" , field->name); +if (field->flags &FIELD_IS_ARRAY ) { offset = field->offset; len = field->size;
@@ -4100,7 +4103,7 @@ static void print_event_fields(struct trace_seq *s, void *data, int size, field = event->format.fields;while (field) { -pevent_field_info (s, field, data, size); +pevent_field_info (s, field, data, size, true); field = field->next; } }
tools/lib/traceevent/event-parse.h +2 -1
@@ -590,7 +590,8 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s,void pevent_field_info (struct trace_seq *s,struct format_field *field, -void *data,int size); +void *data,int size__maybe_unused , +bool print_name);int pevent_parse_header_page (struct pevent *pevent,char *buf,unsigned long size,int long_size);
Signature · 1 line
1.8.3.1
PATCH 17/22 tools lib traceevent: Add pevent_field_cmp function
In reply to Jiri OlsaAdding pevent_field_cmp function to compare 2 fields data, the interface is:
int pevent_field_cmp(struct format_field *a_field,
struct format_field *b_field, void *a_data, int a_size, void *b_data, int b_size);
--- tools/lib/traceevent/event-parse.c | 54 ++++++++++++++++++++++++++++++++++++++ tools/lib/traceevent/event-parse.h | 5 ++++ 2 files changed, 59 insertions(+)
tools/lib/traceevent/event-parse.c +54 -0
@@ -4026,6 +4026,60 @@ static int is_printable_array(char *p, unsigned int len)return 1 ; } +int pevent_field_cmp (struct format_field *a_field, +struct format_field *b_field, +void *a_data,int a_size, +void *b_data,int b_size) +{ +struct event_format *a_event = a_field->event; +struct event_format *b_event = a_field->event; +unsigned int a_offset, b_offset, a_len, b_len, i; +unsigned long long a_val =0 , b_val =0 ; + +if (a_size != b_size) +return a_size - b_size; + +if (a_field->flags &FIELD_IS_ARRAY ) { + a_offset = a_field->offset; + b_offset = b_field->offset; + a_len = a_field->size; + b_len = b_field->size; + +if (a_field->flags &FIELD_IS_DYNAMIC ) { + a_offset =pevent_read_number (a_event->pevent, + a_data + a_offset, + a_len); + a_len = a_offset >>16 ; + a_offset &=0xffff ; + } + +if (b_field->flags &FIELD_IS_DYNAMIC ) { + b_offset =pevent_read_number (b_event->pevent, + b_data + b_offset, + b_len); + b_len = b_offset >>16 ; + b_offset &=0xffff ; + } + +if (a_len != b_len) +return a_len - b_len; + +for (i =0 ; (i < a_len) && (a_val == b_val); i++) { + a_val = *((unsigned char *)a_data + a_offset + i); + b_val = *((unsigned char *)b_data + b_offset + i); + } + }else { + a_val =pevent_read_number (a_event->pevent, + a_data + a_field->offset, + a_field->size); + b_val =pevent_read_number (b_event->pevent, + b_data + b_field->offset, + b_field->size); + } + +return a_val - b_val; +} + void pevent_field_info(struct trace_seq *s, struct format_field *field, void *data, int size __maybe_unused,
tools/lib/traceevent/event-parse.h +5 -0
@@ -588,6 +588,11 @@ int pevent_pid_is_registered(struct pevent *pevent, int pid);void pevent_print_event (struct pevent *pevent,struct trace_seq *s,struct pevent_record *record,bool use_trace_clock); +int pevent_field_cmp (struct format_field *a_field, +struct format_field *b_field, +void *a_data,int a_size, +void *b_data,int b_size); + void pevent_field_info(struct trace_seq *s, struct format_field *field, void *data, int size __maybe_unused,
Signature · 1 line
1.8.3.1
PATCH 18/22 perf tools: Factor sort entries loops
In reply to Jiri OlsaFactoring sort entries loops so we could transparently iterate over hists' specific list of sort entries.
--- tools/perf/ui/browsers/hists.c | 2 +- tools/perf/ui/gtk/hists.c | 6 +++--- tools/perf/ui/hist.c | 5 +++-- tools/perf/ui/stdio/hist.c | 4 ++-- tools/perf/util/hist.c | 4 ++-- tools/perf/util/sort.c | 17 +++++++++++++++++ tools/perf/util/sort.h | 5 +++++ 7 files changed, 33 insertions(+), 10 deletions(-)
tools/perf/ui/browsers/hists.c +1 -1
@@ -342,7 +342,7 @@ static size_t scnprintf_header_se(struct hists *hists, char *buf, size_t size)unsigned int width;int ret =0 ; -list_for_each_entry (se, &hist_entry__sort_list, list) { +hists__for_each_se (hists, se) {if (se->elide)continue ;
tools/perf/ui/gtk/hists.c +3 -3
@@ -240,7 +240,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,perf_hpp__for_each_format (fmt) col_types[nr_cols++] =G_TYPE_STRING ; -list_for_each_entry (se, &hist_entry__sort_list, list) { +hists__for_each_se (hists, se) {if (se->elide)continue ;
@@ -267,7 +267,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists, col_idx++, NULL); } -list_for_each_entry (se, &hist_entry__sort_list, list) { +hists__for_each_se (hists, se) {if (se->elide)continue ;
@@ -318,7 +318,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,gtk_tree_store_set (store, &iter, col_idx++, s,-1 ); } -list_for_each_entry (se, &hist_entry__sort_list, list) { +hists__for_each_se (hists, se) {if (se->elide)continue ;
tools/perf/ui/hist.c +3 -2
@@ -306,7 +306,7 @@ int hist_entry__sort_snprintf(struct hist_entry *he, bool selected,struct sort_entry *se;int ret =0 ; -list_for_each_entry (se, &hist_entry__sort_list, list) { +hists__for_each_se (he->hists, se) {if (se->elide)continue ;
@@ -337,9 +337,10 @@ unsigned int hists__sort_list_width(struct hists *hists) ret += fmt->width (fmt, &dummy_hpp); } -list_for_each_entry (se, &hist_entry__sort_list, list) +hists__for_each_se (hists, se) {if (!se->elide) ret +=2 +hists__col_len (hists, se->se_width_idx); + }if (verbose)/* Addr + origin */ ret +=3 +BITS_PER_LONG /4 ;
tools/perf/ui/stdio/hist.c +2 -2
@@ -408,7 +408,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,fprintf (fp,"%s" , bf); } -list_for_each_entry (se, &hist_entry__sort_list, list) { +hists__for_each_se (hists, se) {if (se->elide)continue ;if (sep) {
@@ -454,7 +454,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,fprintf (fp,"." ); } -list_for_each_entry (se, &hist_entry__sort_list, list) { +hists__for_each_se (hists, se) {unsigned int i;if (se->elide)
tools/perf/util/hist.c +2 -2
@@ -915,7 +915,7 @@ hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)struct sort_entry *se;int64_t cmp =0 ; -list_for_each_entry (se, &hist_entry__sort_list, list) { +hists__for_each_se (left->hists, se) { cmp = se->se_cmp (se, left, right);if (cmp)break ;
@@ -930,7 +930,7 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)struct sort_entry *se;int64_t cmp =0 ; -list_for_each_entry (se, &hist_entry__sort_list, list) { +hists__for_each_se (left->hists, se) {int64_t (*f)(struct sort_entry *,struct hist_entry *,struct hist_entry *);
tools/perf/util/sort.c +17 -0
@@ -1381,3 +1381,20 @@ void sort__setup_list(void) sd_idx->entry->elide = true; } + +bool hists__next_se (struct hists *hists__maybe_unused ,struct sort_entry **sep) +{ +struct list_head *head_global = &hist_entry__sort_list; +struct sort_entry *se = *sep; + +if (!se) { + se = list_first_entry(head_global, struct sort_entry, list); + }else { +if (list_is_last (&se->list, head_global)) + se =NULL ; +else + se =list_next_entry (se, list); + } + +return se ? (*sep = se) : false; +}
tools/perf/util/sort.h +5 -0
@@ -218,4 +218,9 @@ void sort__setup_list(void);int report_parse_ignore_callees_opt (const struct option *opt,const char *arg,int unset); +bool hists__next_se (struct hists *hists,struct sort_entry **sep); + +#define hists__for_each_se (hists, se) \ + for (se = NULL; hists__next_se(hists, &se);) +#endif /* __PERF_SORT_H */
Signature · 1 line
1.8.3.1
PATCH 19/22 perf tools: Add local hists sort entry list
In reply to Jiri OlsaAdding sort_entry list local to 'struct hists'. This way we could setup specific sort entries for separate hists.
This is going to be used for tracepoints fields view in following patch.
--- tools/perf/util/evsel.c | 1 + tools/perf/util/hist.h | 1 + tools/perf/util/sort.c | 14 ++++++++++++-- tools/perf/util/sort.h | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-)
tools/perf/util/evsel.c +1 -0
@@ -122,6 +122,7 @@ void hists__init(struct hists *hists) hists->entries_in = &hists->entries_in_array[0 ]; hists->entries_collapsed =RB_ROOT ; hists->entries =RB_ROOT ; +INIT_LIST_HEAD (&hists->sort_list);pthread_mutex_init (&hists->lock,NULL ); }
tools/perf/util/hist.h +1 -0
@@ -92,6 +92,7 @@ struct hists {u64 time_base;u64 event_stream;u16 col_len[HISTC_NR_COLS ]; +struct list_head sort_list; };struct hist_entry_iter ;
tools/perf/util/sort.c +12 -2
@@ -1382,15 +1382,20 @@ void sort__setup_list(void) sd_idx->entry->elide = true; } -bool hists__next_se (struct hists *hists__maybe_unused ,struct sort_entry **sep) +bool hists__next_se (struct hists *hists,struct sort_entry **sep) {struct list_head *head_global = &hist_entry__sort_list; +struct list_head *head_local = &hists->sort_list;struct sort_entry *se = *sep;if (!se) { se = list_first_entry(head_global, struct sort_entry, list); }else { -if (list_is_last (&se->list, head_global)) +if (list_is_last (&se->list, head_global)) { + se =list_empty (head_local) ?NULL : + list_first_entry(head_local, struct sort_entry, + list); + }else if (list_is_last (&se->list, head_local)) se =NULL ;else se =list_next_entry (se, list);
@@ -1398,3 +1403,8 @@ bool hists__next_se(struct hists *hists __maybe_unused, struct sort_entry **sep)return se ? (*sep = se) : false; } + +void hists__sort_entry_add (struct hists *hists,struct sort_entry *se) +{ +list_add_tail (&se->list, &hists->sort_list); +}
tools/perf/util/sort.h +2 -0
@@ -223,4 +223,6 @@ bool hists__next_se(struct hists *hists, struct sort_entry **sep);#define hists__for_each_se (hists, se) \ for (se = NULL; hists__next_se(hists, &se);) +void hists__sort_entry_add (struct hists *hists,struct sort_entry *se); +#endif /* __PERF_SORT_H */
Signature · 1 line
1.8.3.1
Quoted 2 lines · Jiri Olsa
hi,
sending out tracepoint (mostly) events display enahncements.
forgot to mention.. the branch is in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/core_tp
and it's based on namhyuung's perf/cumulate-v7 branch
jirka
Quoted 121 lines
* adding the '--tp' option for report command to show tracepoint related info. Use can specify following switches:
fields: shows separated tracepoint fields
format: shows tracepoints 'print fmt' in single column
(This is default if no switch is given.)$ perf report --tp --no-children Samples: 4K of event 'sched:sched_switch', Event count (approx.): 4788 Overhead Command Shared Object Symbol Print fmt + 26.27% swapper [kernel.kallsyms] [k] __schedule swapper/2:0 [120] R ==> offlineimap:22134 [120] + 26.27% offlineimap [kernel.kallsyms] [k] __schedule offlineimap:22134 [120] S ==> swapper/2:0 [120] - 8.15% swapper [kernel.kallsyms] [k] __schedule swapper/3:0 [120] R ==> offlineimap:22134 [120] __schedule schedule_preempt_disabled cpu_startup_entry start_secondary + 8.15% offlineimap [kernel.kallsyms] [k] __schedule offlineimap:22134 [120] S ==> swapper/3:0 [120]$ perf report --tp=fields --no-children Samples: 4K of event 'sched:sched_switch', Event count (approx.): 4788 Overhead Command Shared Object Symbol prev_comm prev_pid prev_prio prev_state next_comm next_pid next_prio + 26.27% swapper [kernel.kallsyms] [k] __schedule swapper/2 0 120 0 offlineimap 22134 120 + 26.27% offlineimap [kernel.kallsyms] [k] __schedule offlineimap 22134 120 1 swapper/2 0 120 - 8.15% swapper [kernel.kallsyms] [k] __schedule swapper/3 0 120 0 offlineimap 22134 120 __schedule schedule_preempt_disabled cpu_startup_entry start_secondary + 8.15% offlineimap [kernel.kallsyms] [k] __schedule offlineimap 22134 120 1 swapper/3 0 120* adding '--list' report option to display entries sequentialy:
Samples: 2K of event 'sched:sched_switch', Event count (approx.): 2450
Self Children Time Command Shared Object Symbol Print fmt + 0.04% 0.04% 9582.431783 +000000.000000 swapper [kernel.kallsyms] [k] __schedule swapper/1:0 [120] R ==> perf:11168 [120] - 0.00% 0.04% 9582.431783 +000000.000000 swapper [kernel.kallsyms] [k] __schedule swapper/1:0 [120] R ==> perf:11168 [120] __schedule schedule cpu_idle start_secondary + 0.00% 0.04% 9582.431783 +000000.000000 swapper [kernel.kallsyms] [k] schedule swapper/1:0 [120] R ==> perf:11168 [120] + 0.00% 0.04% 9582.431783 +000000.000000 swapper [kernel.kallsyms] [k] cpu_idle swapper/1:0 [120] R ==> perf:11168 [120]* adding 'H' key handler to togle header columns
thanks for comments,
jirkaSigned-off-by Jiri Olsa <[email protected]>Cc Corey Ashford <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Ingo Molnar <[email protected]>Cc Namhyung Kim <[email protected]>Cc Paul Mackerras <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Steven Rostedt <[email protected]>Cc David Ahern <[email protected]>---
Jiri Olsa (22):
perf tools: Fix memory leak inevent_format__printfunction perf tools: Add time sort entry
perf tools: Add idx sort entry
perf tools: Add --list report option
perf tools: Addsort_entrystruct into sort entries callbacks perf tools: Add selected bool intose_snprintfsort entries callback perf tools: Implement selected boolse_snprintfcallback logic perf tools: Implement selected logic for time sort entry perf tools: Factorui_browserops out ofui_browserstruct perf tools: Add header callback intoui_browser_opsstruct perf tools: Removeev_nameargument fromperf_evsel__hists_browseperf tools: Add header callback to hist browser
perf tools: Factorhpp_argstruct to carryhist_browserperf tools tui: Display columns header text on 'H' press tools lib traceevent: Factorprint_event_fieldsfunction tools lib traceevent: Make the name output optional inpevent_field_infotools lib traceevent: Addpevent_field_cmpfunction
perf tools: Factor sort entries loops
perf tools: Add local hists sort entry list
perf tools: Make histscol_lendynamicaly alocated
perf tools: Add raw info into hist entry
perf tools: Add support for tracepoint fieldstools/lib/traceevent/event-parse.c | 181 +++++++++++++++++++++---------- tools/lib/traceevent/event-parse.h | 10 ++ tools/perf/Documentation/perf-report.txt | 6 ++ tools/perf/Makefile.perf | 1 + tools/perf/builtin-annotate.c | 4 +- tools/perf/builtin-diff.c | 4 +- tools/perf/builtin-report.c | 52 ++++++++- tools/perf/tests/hists_link.c | 6 +- tools/perf/ui/browser.c | 101 ++++++++++++----- tools/perf/ui/browser.h | 31 ++++-- tools/perf/ui/browsers/annotate.c | 19 ++-- tools/perf/ui/browsers/header.c | 8 +- tools/perf/ui/browsers/hists.c | 168 ++++++++++++++++++++++------- tools/perf/ui/browsers/map.c | 8 +- tools/perf/ui/browsers/scripts.c | 2 +- tools/perf/ui/gtk/hists.c | 8 +- tools/perf/ui/hist.c | 10 +- tools/perf/ui/stdio/hist.c | 6 +- tools/perf/ui/tui/util.c | 8 +- tools/perf/util/evsel.c | 24 +++-- tools/perf/util/evsel.h | 6 +- tools/perf/util/hist.c | 65 ++++++++--- tools/perf/util/hist.h | 20 +++- tools/perf/util/python.c | 3 +- tools/perf/util/report-tp.c | 244 +++++++++++++++++++++++++++++++++++++++++ tools/perf/util/report-tp.h | 18 ++++ tools/perf/util/sort.c | 370 +++++++++++++++++++++++++++++++++++++++++++++++++-------------- tools/perf/util/sort.h | 29 ++++- tools/perf/util/symbol.h | 3 +- tools/perf/util/trace-event-parse.c | 1 + tools/perf/util/util.h | 17 +++ 31 files changed, 1144 insertions(+), 289 deletions(-) create mode 100644 tools/perf/util/report-tp.c create mode 100644 tools/perf/util/report-tp.h
Namhyung Kim
maintainerQuoted 7 lines · Jiri Olsa
Quoted 2 lines · Jiri Olsa
hi,
sending out tracepoint (mostly) events display enahncements.forgot to mention.. the branch is in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/core_tp
It's segfaulted with --group --tui option since the hpp->ptr is not setup to point an evsel. Not sure whose problem.. ;-)
Thanks,
Namhyung
Quoted 11 lines · Namhyung Kim
Quoted 7 lines · Jiri Olsa
Quoted 2 lines · Jiri Olsa
hi,
sending out tracepoint (mostly) events display enahncements.forgot to mention.. the branch is in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/core_tpIt's segfaulted with --group --tui option since the
hpp->ptris not setup to point an evsel. Not sure whose problem.. ;-)
will check ;-) thanks
jirka
PATCH 20/22 perf tools: Make hists col_len dynamicaly alocated
In reply to Jiri OlsaMaking hists col_len dynamicaly allocated as a support for dynamic sort entries.
--- tools/perf/util/evsel.c | 23 ++++++++++++++++------- tools/perf/util/evsel.h | 6 +++--- tools/perf/util/hist.c | 15 +++++++++++++++ tools/perf/util/hist.h | 4 +++- tools/perf/util/python.c | 3 +-- 5 files changed, 38 insertions(+), 13 deletions(-)
tools/perf/util/evsel.c +16 -7
@@ -115,7 +115,7 @@ void perf_evsel__calc_id_pos(struct perf_evsel *evsel) evsel->is_pos =__perf_evsel__calc_is_pos (evsel->attr.sample_type); } -void hists__init (struct hists *hists) +int hists__init (struct hists *hists) {memset (hists,0 ,sizeof (*hists)); hists->entries_in_array[0 ] = hists->entries_in_array[1 ] =RB_ROOT ;
@@ -124,6 +124,12 @@ void hists__init(struct hists *hists) hists->entries =RB_ROOT ;INIT_LIST_HEAD (&hists->sort_list);pthread_mutex_init (&hists->lock,NULL ); +return hists__alloc_col_len (hists,HISTC_NR_COLS ); +} + +static void hists__exit (struct hists *hists) +{ +free (hists->col_len); } void __perf_evsel__set_sample_bit(struct perf_evsel *evsel,
@@ -158,8 +164,8 @@ void perf_evsel__set_sample_id(struct perf_evsel *evsel, evsel->attr.read_format |=PERF_FORMAT_ID ; } -void perf_evsel__init (struct perf_evsel *evsel, -struct perf_event_attr *attr,int idx) +int perf_evsel__init (struct perf_evsel *evsel, +struct perf_event_attr *attr,int idx) { evsel->idx = idx; evsel->attr = *attr;
@@ -167,19 +173,20 @@ void perf_evsel__init(struct perf_evsel *evsel, evsel->unit ="" ; evsel->scale =1.0 ;INIT_LIST_HEAD (&evsel->node); -hists__init (&evsel->hists); evsel->sample_size =__perf_evsel__sample_size (attr->sample_type);perf_evsel__calc_id_pos (evsel); +return hists__init (&evsel->hists); }struct perf_evsel *perf_evsel__new_idx (struct perf_event_attr *attr,int idx) {struct perf_evsel *evsel =zalloc (sizeof (*evsel)); +int err = -ENOMEM ;if (evsel !=NULL ) -perf_evsel__init (evsel, attr, idx); + err =perf_evsel__init (evsel, attr, idx); -return evsel; +return err ?NULL : evsel; }struct perf_evsel *perf_evsel__newtp_idx (const char *sys,const char *name,int idx)
@@ -203,7 +210,8 @@ struct perf_evsel *perf_evsel__newtp_idx(const char *sys, const char *name, intevent_attr_init (&attr); attr.config = evsel->tp_format->id; attr.sample_period =1 ; -perf_evsel__init (evsel, &attr, idx); +if (perf_evsel__init (evsel, &attr, idx)) + goto out_free; }return evsel;
@@ -776,6 +784,7 @@ void perf_evsel__exit(struct perf_evsel *evsel)assert (list_empty (&evsel->node));perf_evsel__free_fd (evsel);perf_evsel__free_id (evsel); +hists__exit (&evsel->hists); }void perf_evsel__delete (struct perf_evsel *evsel)
tools/perf/util/evsel.h +3 -3
@@ -114,8 +114,8 @@ static inline struct perf_evsel *perf_evsel__newtp(const char *sys, const char *struct event_format *event_format__new (const char *sys,const char *name); -void perf_evsel__init (struct perf_evsel *evsel, -struct perf_event_attr *attr,int idx); +int perf_evsel__init (struct perf_evsel *evsel, +struct perf_event_attr *attr,int idx);void perf_evsel__exit (struct perf_evsel *evsel);void perf_evsel__delete (struct perf_evsel *evsel);
@@ -272,7 +272,7 @@ static inline int perf_evsel__read_scaled(struct perf_evsel *evsel,return __perf_evsel__read (evsel, ncpus, nthreads, true); } -void hists__init (struct hists *hists); +int hists__init (struct hists *hists);int perf_evsel__parse_sample (struct perf_evsel *evsel,union perf_event *event,struct perf_sample *sample);
tools/perf/util/hist.c +15 -0
@@ -21,6 +21,21 @@ struct callchain_param callchain_param = { .key = CCKEY_FUNCTION }; +int hists__alloc_col_len (struct hists *hists,int n) +{ +u16 *col_len = hists->col_len; +int old_n = hists->col_n; + + col_len =realloc (col_len, n *sizeof (u16)); +if (col_len) { +memset (col_len + old_n,0 , n - old_n); + hists->col_len = col_len; + hists->col_n = n; + } + +return col_len ?0 : -ENOMEM ; +} +u16 hists__col_len (struct hists *hists,enum hist_column col) {return hists->col_len[col];
tools/perf/util/hist.h +3 -1
@@ -91,7 +91,8 @@ struct hists {struct events_stats stats;u64 time_base;u64 event_stream; -u16 col_len[HISTC_NR_COLS ]; +u16 *col_len; +int col_n;struct list_head sort_list; };
@@ -168,6 +169,7 @@ void hists__filter_by_dso(struct hists *hists);void hists__filter_by_thread (struct hists *hists);void hists__filter_by_symbol (struct hists *hists); +int hists__alloc_col_len (struct hists *hists,int n);u16 hists__col_len (struct hists *hists,enum hist_column col);void hists__set_col_len (struct hists *hists,enum hist_column col,u16 len);bool hists__new_col_len (struct hists *hists,enum hist_column col,u16 len);
tools/perf/util/python.c +1 -2
@@ -605,8 +605,7 @@ static int pyrf_evsel__init(struct pyrf_evsel *pevsel, attr.mmap_data = mmap_data; attr.sample_id_all = sample_id_all; -perf_evsel__init (&pevsel->evsel, &attr, idx); -return 0 ; +return perf_evsel__init (&pevsel->evsel, &attr, idx); }static void pyrf_evsel__delete (struct pyrf_evsel *pevsel)
Signature · 1 line
1.8.3.1
PATCH 21/22 perf tools: Add raw info into hist entry
In reply to Jiri OlsaAdding support to store raw info into hist entry, so we could use it for entries sorting and display.
--- tools/perf/builtin-annotate.c | 4 ++-- tools/perf/builtin-diff.c | 4 ++-- tools/perf/builtin-report.c | 31 ++++++++++++++++++++++++++++++- tools/perf/tests/hists_link.c | 6 ++++-- tools/perf/util/hist.c | 21 +++++++++++++++------ tools/perf/util/hist.h | 7 +++++-- tools/perf/util/sort.h | 6 ++++++ 7 files changed, 64 insertions(+), 15 deletions(-)
tools/perf/builtin-annotate.c +2 -2
@@ -65,8 +65,8 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,return 0 ; } - he =__hists__add_entry (&evsel->hists, al,NULL ,NULL ,NULL ,1 ,1 ,0 ,0 , - true); + he =__hists__add_entry (&evsel->hists, al,NULL ,NULL ,NULL ,NULL , +1 ,1 ,0 ,0 , true);if (he ==NULL )return -ENOMEM ;
tools/perf/builtin-diff.c +2 -2
@@ -307,8 +307,8 @@ static int hists__add_entry(struct hists *hists, struct addr_location *al, u64 period, u64 weight, u64 transaction) { - if (__hists__add_entry(hists, al, NULL, NULL, NULL, period, weight, - transaction, 0, true) != NULL) + if (__hists__add_entry(hists, al, NULL, NULL, NULL, NULL, + period, weight, transaction, 0, true) != NULL) return 0; return -ENOMEM; }
tools/perf/builtin-report.c +30 -1
@@ -47,6 +47,7 @@ struct report {bool dont_use_callchains;bool show_full_info;bool show_threads; +bool raw_info;bool inverted_callchain;bool mem_mode;bool header;
@@ -108,6 +109,23 @@ out:return err; } +static int get_raw_info (struct raw_info **rawp,struct perf_sample *sample) +{ +struct raw_info *raw; + +if (!sample->raw_data) +return 0 ; + + raw =malloc (sizeof (*raw) + sample->raw_size); +if (raw) { +memcpy (&raw->data, sample->raw_data, sample->raw_size); + raw->size = sample->raw_size; + } + + *rawp = raw; +return raw ?0 : -ENOMEM ; +} + static int process_sample_event(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample,
@@ -119,6 +137,7 @@ static int process_sample_event(struct perf_tool *tool,struct hist_entry_iter iter = { .hide_unresolved = rep->hide_unresolved, }; +struct raw_info *raw =NULL ;int ret;if (perf_event__preprocess_sample (event, machine, &al, sample) <0 ) {
@@ -133,6 +152,12 @@ static int process_sample_event(struct perf_tool *tool,if (rep->cpu_list && !test_bit (sample->cpu, rep->cpu_bitmap))return 0 ; +if (rep->raw_info) { + ret =get_raw_info (&raw, sample); +if (ret) +return ret; + } +if (sort__mode ==SORT_MODE__BRANCH ) iter.ops = &hist_iter_branch;else if (rep->mem_mode ==1 )
@@ -145,13 +170,17 @@ static int process_sample_event(struct perf_tool *tool, iter.add_entry_cb = hist_iter_cb; } + iter.raw = raw; +if (al.map !=NULL ) al.map->dso->hit =1 ; ret =hist_entry_iter__add (&iter, &al, evsel, event, sample, rep->max_stack,NULL ); -if (ret <0 ) +if (ret <0 ) {pr_debug ("problem adding hist entry, skipping event\n" ); +free (raw); + }return ret; }
tools/perf/tests/hists_link.c +4 -2
@@ -223,7 +223,8 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) goto out; he =__hists__add_entry (&evsel->hists, &al,NULL , -NULL ,NULL ,1 ,1 ,0 ,0 , true); +NULL ,NULL ,NULL ,1 ,1 ,0 ,0 , + true);if (he ==NULL ) goto out;
@@ -246,7 +247,8 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) goto out; he =__hists__add_entry (&evsel->hists, &al,NULL , -NULL ,NULL ,1 ,1 ,0 ,0 , true); +NULL ,NULL ,NULL ,1 ,1 ,0 ,0 , + true);if (he ==NULL ) goto out;
tools/perf/util/hist.c +15 -6
@@ -450,6 +450,7 @@ struct hist_entry *__hists__add_entry(struct hists *hists,struct symbol *sym_parent, struct branch_info *bi, struct mem_info *mi, + struct raw_info *raw, u64 period, u64 weight, u64 transaction, u64 t, bool sample_self) {
@@ -474,6 +475,7 @@ struct hist_entry *__hists__add_entry(struct hists *hists, .hists = hists, .branch_info = bi, .mem_info = mi, + .raw_info = raw, .transaction = transaction, .time = t, .idx = idx++,
@@ -535,8 +537,8 @@ iter_add_single_mem_entry(struct hist_entry_iter *iter, struct addr_location *al* and this is indirectly achieved by passing period=weight here * and the he_stat__add_period() function. */ - he =__hists__add_entry (&iter->evsel->hists, al, iter->parent,NULL , mi, - cost, cost,0 ,0 , true); + he =__hists__add_entry (&iter->evsel->hists, al, iter->parent,NULL , + mi,NULL , cost, cost,0 ,0 , true);if (!he)return -ENOMEM ;
@@ -647,7 +649,8 @@ iter_add_next_branch_entry(struct hist_entry_iter *iter, struct addr_location *a* The report shows the percentage of total branches captured * and not events sampled. Thus we use a pseudo period of 1. */ - he =__hists__add_entry (&evsel->hists, al, iter->parent, &bi[i],NULL , + he =__hists__add_entry (&evsel->hists, al, iter->parent, + &bi[i],NULL ,NULL ,1 ,1 ,0 ,0 , true);if (he ==NULL )return -ENOMEM ;
@@ -692,7 +695,8 @@ iter_add_single_normal_entry(struct hist_entry_iter *iter, struct addr_locationstruct perf_sample *sample = iter->sample;struct hist_entry *he; - he =__hists__add_entry (&evsel->hists, al, iter->parent,NULL ,NULL , + he =__hists__add_entry (&evsel->hists, al, iter->parent, +NULL ,NULL , iter->raw, sample->period, sample->weight, sample->transaction, sample->time, true);if (he ==NULL )
@@ -748,7 +752,8 @@ iter_add_single_cumulative_entry(struct hist_entry_iter *iter,struct hist_entry **he_cache = iter->priv;struct hist_entry *he; - he =__hists__add_entry (&evsel->hists, al, iter->parent,NULL ,NULL , + he =__hists__add_entry (&evsel->hists, al, iter->parent, +NULL ,NULL , iter->raw, sample->period, sample->weight, sample->transaction, sample->time, true);if (he ==NULL )
@@ -803,6 +808,8 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter,int i;struct callchain_cursor cursor; + he_tmp.raw_info = iter->raw; +callchain_cursor_snapshot (&cursor, &callchain_cursor);callchain_cursor_advance (&callchain_cursor);
@@ -819,7 +826,8 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter, } } - he =__hists__add_entry (&evsel->hists, al, iter->parent,NULL ,NULL , + he =__hists__add_entry (&evsel->hists, al, iter->parent, +NULL ,NULL , iter->raw, sample->period, sample->weight, sample->transaction, sample->time, false);if (he ==NULL )
@@ -961,6 +969,7 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)void hist_entry__free (struct hist_entry *he) { +zfree (&he->raw_info);zfree (&he->branch_info);zfree (&he->mem_info);zfree (&he->stat_acc);
tools/perf/util/hist.h +5 -2
@@ -13,6 +13,7 @@ extern struct callchain_param callchain_param;struct hist_entry ;struct addr_location ;struct symbol ; +struct raw_info ;enum hist_filter {HIST_FILTER__DSO ,
@@ -117,6 +118,7 @@ struct hist_entry_iter {struct perf_sample *sample;struct hist_entry *he;struct symbol *parent; +struct raw_info *raw;void *priv;const struct hist_iter_ops *ops;
@@ -134,8 +136,9 @@ struct hist_entry *__hists__add_entry(struct hists *hists,struct addr_location *al, struct symbol *parent, struct branch_info *bi, - struct mem_info *mi, u64 period, - u64 weight, u64 transaction, + struct mem_info *mi, + struct raw_info *raw, + u64 period, u64 weight, u64 transaction, u64 time, bool sample_self); int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al, struct perf_evsel *evsel, const union perf_event *event,
tools/perf/util/sort.h +6 -0
@@ -67,6 +67,11 @@ struct hist_entry_diff {s64 wdiff; }; +struct raw_info { +unsigned int size; +unsigned char data[]; +}; +/** * struct hist_entry - histogram entry *
@@ -111,6 +116,7 @@ struct hist_entry {struct branch_info *branch_info;struct hists *hists;struct mem_info *mem_info; +struct raw_info *raw_info;struct callchain_root callchain[0 ];/* must be last member */ };
Signature · 1 line
1.8.3.1
PATCH 22/22 perf tools: Add support for tracepoint fields
In reply to Jiri OlsaAdding '--tp' option for report command to show tracepoint related info. Use can specify following switches:
- fields: shows separated tracepoint fields
- format: shows tracepoints 'print fmt' in single column (This is default if no switch is given.)
$ perf report --tp --no-children
Samples: 4K of event 'sched:sched_switch', Event count (approx.): 4788
Overhead Command Shared Object Symbol Print fmt
+ 26.27% swapper [kernel.kallsyms] [k] __schedule swapper/2:0 [120] R ==> offlineimap:22134 [120]
+ 26.27% offlineimap [kernel.kallsyms] [k] __schedule offlineimap:22134 [120] S ==> swapper/2:0 [120]
- 8.15% swapper [kernel.kallsyms] [k] __schedule swapper/3:0 [120] R ==> offlineimap:22134 [120]
__schedule
schedule_preempt_disabled
cpu_startup_entry
start_secondary
+ 8.15% offlineimap [kernel.kallsyms] [k] __schedule offlineimap:22134 [120] S ==> swapper/3:0 [120] $ perf report --tp=fields --no-children
Samples: 4K of event 'sched:sched_switch', Event count (approx.): 4788
Overhead Command Shared Object Symbol prev_comm prev_pid prev_prio prev_state next_comm next_pid next_prio
+ 26.27% swapper [kernel.kallsyms] [k] __schedule swapper/2 0 120 0 offlineimap 22134 120
+ 26.27% offlineimap [kernel.kallsyms] [k] __schedule offlineimap 22134 120 1 swapper/2 0 120
- 8.15% swapper [kernel.kallsyms] [k] __schedule swapper/3 0 120 0 offlineimap 22134 120
__schedule
schedule_preempt_disabled
cpu_startup_entry
start_secondary
+ 8.15% offlineimap [kernel.kallsyms] [k] __schedule offlineimap 22134 120 1 swapper/3 0 120--- tools/perf/Documentation/perf-report.txt | 6 + tools/perf/Makefile.perf | 1 + tools/perf/builtin-report.c | 15 ++ tools/perf/util/report-tp.c | 244 +++++++++++++++++++++++++++++++ tools/perf/util/report-tp.h | 18 +++ 5 files changed, 284 insertions(+) create mode 100644 tools/perf/util/report-tp.c create mode 100644 tools/perf/util/report-tp.h
tools/perf/Documentation/perf-report.txt +6 -0
@@ -263,6 +263,12 @@ OPTIONS --header-only:: Show only perf.data header (forces --stdio). +--tp=:: + Show tracepoint related info, following switches are supported: + - fields: shows separated tracepoint fields + - format: shows tracepoints 'print fmt' in single column + (This is default if no switch is given.) + SEE ALSO -------- linkperf:perf-stat[1], linkperf:perf-annotate[1]
tools/perf/Makefile.perf +1 -0
@@ -373,6 +373,7 @@ LIB_OBJS += $(OUTPUT)util/stat.o LIB_OBJS += $(OUTPUT)util/record.o LIB_OBJS += $(OUTPUT)util/srcline.o LIB_OBJS += $(OUTPUT)util/data.o +LIB_OBJS += $(OUTPUT)util/report-tp.o LIB_OBJS += $(OUTPUT)ui/setup.o LIB_OBJS += $(OUTPUT)ui/helpline.o
tools/perf/builtin-report.c +15 -0
@@ -35,6 +35,7 @@#include "util/hist.h" #include "util/data.h" #include "arch/common.h" +#include "util/report-tp.h" #include <dlfcn.h> #include <linux/bitmap.h>
@@ -664,6 +665,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)"perf report [<options>]" ,NULL }; +enum report_tp_mode tp_mode;struct report report = { .tool = { .sample = process_sample_event,
@@ -779,6 +781,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)OPT_CALLBACK (0 ,"percentage" ,NULL ,"relative|absolute" ,"how to display percentage of filtered entries" , parse_percentage),OPT_BOOLEAN (0 ,"list" , &symbol_conf.show_list,"Show events list" ), +OPT_CALLBACK_DEFAULT (0 ,"tp" , &tp_mode,"fields,[format]" ,NULL , + &report_tp_parse_mode,"format" ), +OPT_END () }; struct perf_data_file file = {
@@ -924,6 +929,16 @@ repeat:if (symbol_conf.show_list)sort__setup_list (); +if (tp_mode !=REPORT_TO_MODE__NONE ) { + ret =perf_evlist__add_tp_sort_entries (session->evlist, + tp_mode); +if (ret) { +pr_err ("failed to add tracepoints sort entries\n" ); + goto error; + } + report.raw_info = true; + } + ret =__cmd_report (&report);if (ret ==K_SWITCH_INPUT_DATA ) {perf_session__delete (session);
tools/perf/util/report-tp.c new file +244 -0
244 lines not on this page · raw message
tools/perf/util/report-tp.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef PERF_REPORT_TP_H +#define PERF_REPORT_TP_H + +#include "parse-options.h" + +enum report_tp_mode { +REPORT_TO_MODE__NONE , +REPORT_TO_MODE__FIELDS , +REPORT_TO_MODE__FORMAT , +}; + +int perf_evlist__add_tp_sort_entries (struct perf_evlist *evlist, +enum report_tp_mode mode); + +int report_tp_parse_mode (const struct option *opt, +const char *str,int unset); + +#endif /* PERF_REPORT_TP_H */
Signature · 1 line
1.8.3.1
Namhyung Kim
maintainerQuoted 8 lines · Jiri Olsa
hi,
sending out tracepoint (mostly) events display enahncements.* adding the '--tp' option for report command to show tracepoint related info. Use can specify following switches:
fields: shows separated tracepoint fields
format: shows tracepoints 'print fmt' in single column
(This is default if no switch is given.)
Looks like an useful feature.. but unfortunately it seems not to work well with --children and (especially) --group options. Do you have an idea?
Also as Ingo requested I plan to extend controlling output column with -F/--field option. I think I need to more consideration..
Thanks,
Namhyung
Quoted 115 lines
$ perf report --tp --no-children Samples: 4K of event 'sched:sched_switch', Event count (approx.): 4788 Overhead Command Shared Object Symbol Print fmt + 26.27% swapper [kernel.kallsyms] [k] __schedule swapper/2:0 [120] R ==> offlineimap:22134 [120] + 26.27% offlineimap [kernel.kallsyms] [k] __schedule offlineimap:22134 [120] S ==> swapper/2:0 [120] - 8.15% swapper [kernel.kallsyms] [k] __schedule swapper/3:0 [120] R ==> offlineimap:22134 [120] __schedule schedule_preempt_disabled cpu_startup_entry start_secondary + 8.15% offlineimap [kernel.kallsyms] [k] __schedule offlineimap:22134 [120] S ==> swapper/3:0 [120]$ perf report --tp=fields --no-children Samples: 4K of event 'sched:sched_switch', Event count (approx.): 4788 Overhead Command Shared Object Symbol prev_comm prev_pid prev_prio prev_state next_comm next_pid next_prio + 26.27% swapper [kernel.kallsyms] [k] __schedule swapper/2 0 120 0 offlineimap 22134 120 + 26.27% offlineimap [kernel.kallsyms] [k] __schedule offlineimap 22134 120 1 swapper/2 0 120 - 8.15% swapper [kernel.kallsyms] [k] __schedule swapper/3 0 120 0 offlineimap 22134 120 __schedule schedule_preempt_disabled cpu_startup_entry start_secondary + 8.15% offlineimap [kernel.kallsyms] [k] __schedule offlineimap 22134 120 1 swapper/3 0 120* adding '--list' report option to display entries sequentialy:
Samples: 2K of event 'sched:sched_switch', Event count (approx.): 2450
Self Children Time Command Shared Object Symbol Print fmt + 0.04% 0.04% 9582.431783 +000000.000000 swapper [kernel.kallsyms] [k] __schedule swapper/1:0 [120] R ==> perf:11168 [120] - 0.00% 0.04% 9582.431783 +000000.000000 swapper [kernel.kallsyms] [k] __schedule swapper/1:0 [120] R ==> perf:11168 [120] __schedule schedule cpu_idle start_secondary + 0.00% 0.04% 9582.431783 +000000.000000 swapper [kernel.kallsyms] [k] schedule swapper/1:0 [120] R ==> perf:11168 [120] + 0.00% 0.04% 9582.431783 +000000.000000 swapper [kernel.kallsyms] [k] cpu_idle swapper/1:0 [120] R ==> perf:11168 [120]* adding 'H' key handler to togle header columns
thanks for comments,
jirkaSigned-off-by Jiri Olsa <[email protected]>Cc Corey Ashford <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Ingo Molnar <[email protected]>Cc Namhyung Kim <[email protected]>Cc Paul Mackerras <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Steven Rostedt <[email protected]>Cc David Ahern <[email protected]>---
Jiri Olsa (22):
perf tools: Fix memory leak inevent_format__printfunction perf tools: Add time sort entry
perf tools: Add idx sort entry
perf tools: Add --list report option
perf tools: Addsort_entrystruct into sort entries callbacks perf tools: Add selected bool intose_snprintfsort entries callback perf tools: Implement selected boolse_snprintfcallback logic perf tools: Implement selected logic for time sort entry perf tools: Factorui_browserops out ofui_browserstruct perf tools: Add header callback intoui_browser_opsstruct perf tools: Removeev_nameargument fromperf_evsel__hists_browseperf tools: Add header callback to hist browser
perf tools: Factorhpp_argstruct to carryhist_browserperf tools tui: Display columns header text on 'H' press tools lib traceevent: Factorprint_event_fieldsfunction tools lib traceevent: Make the name output optional inpevent_field_infotools lib traceevent: Addpevent_field_cmpfunction
perf tools: Factor sort entries loops
perf tools: Add local hists sort entry list
perf tools: Make histscol_lendynamicaly alocated
perf tools: Add raw info into hist entry
perf tools: Add support for tracepoint fieldstools/lib/traceevent/event-parse.c | 181 +++++++++++++++++++++---------- tools/lib/traceevent/event-parse.h | 10 ++ tools/perf/Documentation/perf-report.txt | 6 ++ tools/perf/Makefile.perf | 1 + tools/perf/builtin-annotate.c | 4 +- tools/perf/builtin-diff.c | 4 +- tools/perf/builtin-report.c | 52 ++++++++- tools/perf/tests/hists_link.c | 6 +- tools/perf/ui/browser.c | 101 ++++++++++++----- tools/perf/ui/browser.h | 31 ++++-- tools/perf/ui/browsers/annotate.c | 19 ++-- tools/perf/ui/browsers/header.c | 8 +- tools/perf/ui/browsers/hists.c | 168 ++++++++++++++++++++++------- tools/perf/ui/browsers/map.c | 8 +- tools/perf/ui/browsers/scripts.c | 2 +- tools/perf/ui/gtk/hists.c | 8 +- tools/perf/ui/hist.c | 10 +- tools/perf/ui/stdio/hist.c | 6 +- tools/perf/ui/tui/util.c | 8 +- tools/perf/util/evsel.c | 24 +++-- tools/perf/util/evsel.h | 6 +- tools/perf/util/hist.c | 65 ++++++++--- tools/perf/util/hist.h | 20 +++- tools/perf/util/python.c | 3 +- tools/perf/util/report-tp.c | 244 +++++++++++++++++++++++++++++++++++++++++ tools/perf/util/report-tp.h | 18 ++++ tools/perf/util/sort.c | 370 +++++++++++++++++++++++++++++++++++++++++++++++++-------------- tools/perf/util/sort.h | 29 ++++- tools/perf/util/symbol.h | 3 +- tools/perf/util/trace-event-parse.c | 1 + tools/perf/util/util.h | 17 +++ 31 files changed, 1144 insertions(+), 289 deletions(-) create mode 100644 tools/perf/util/report-tp.c create mode 100644 tools/perf/util/report-tp.h