perf tools: Cleanup for sort keys (v3)
Namhyung Kim
maintainercover perf tools: Cleanup for sort keys (v3)
Hi,
In this version, I've fixed up the last minute bug on hex print and separate out SRCLINE reordering.
$ perf report -s addr | grep -v ^# | sort -k2 -n
0.00% 0x400523
0.00% 0xffffffff81018140
0.00% 0xffffffff810181a2
0.00% 0xffffffff8101a41a
0.00% 0xffffffff8101a977
0.00% 0xffffffff810229da
0.00% 0xffffffff8103becf
... The patches are in 'perf/sort-v5' branch on my tree at:
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
Any comments are welcome, thanks.
Namhyung
Namhyung Kim (8):
perf sort: Reorder HISTC_SRCLINE index
perf sort: Add 'addr' sort key
perf sort: Add 'addr_to/from' sort key
perf sort: Update documentation for sort keys
perf hists: Move column length setting code
perf sort: Cleanup sort__has_sym setting
perf top: Use sort__has_sym
perf hist browser: Use sort__has_sym
tools/perf/Documentation/perf-diff.txt | 2 +- tools/perf/Documentation/perf-report.txt | 5 +- tools/perf/Documentation/perf-top.txt | 2 +- tools/perf/builtin-diff.c | 2 +- tools/perf/builtin-report.c | 6 +-- tools/perf/builtin-top.c | 15 ++---- tools/perf/ui/browsers/hists.c | 9 +--- tools/perf/util/hist.c | 17 ++++--- tools/perf/util/hist.h | 5 +- tools/perf/util/sort.c | 82 ++++++++++++++++++++++++++++++-- tools/perf/util/sort.h | 3 ++ tools/perf/util/top.h | 1 - 12 files changed, 112 insertions(+), 37 deletions(-)
Signature · 1 line
1.7.11.7
Namhyung Kim
maintainerPATCH 1/8 perf sort: Reorder HISTC_SRCLINE index
From: Namhyung Kim <[email protected]>
It's in common sort dimension so it'd be more natural to place it with other common column index.
--- tools/perf/util/hist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/hist.h +1 -1
@@ -43,12 +43,12 @@ enum hist_column {HISTC_COMM ,HISTC_PARENT ,HISTC_CPU , +HISTC_SRCLINE ,HISTC_MISPREDICT ,HISTC_SYMBOL_FROM ,HISTC_SYMBOL_TO ,HISTC_DSO_FROM ,HISTC_DSO_TO , -HISTC_SRCLINE ,HISTC_LOCAL_WEIGHT ,HISTC_GLOBAL_WEIGHT , HISTC_MEM_DADDR_SYMBOL,
Signature · 1 line
1.7.11.7
tip-bot for Namhyung Kim
merge bot[tip:perf/core] perf sort: Reorder HISTC_SRCLINE index
perf sort: Reorder HISTC_SRCLINE index
Commit-ID: dfd3b2fd485e3969a30b28e70aabfefa90b81c9c Gitweb: http://git.kernel.org/tip/dfd3b2fd485e3969a30b28e70aabfefa90b81c9c Author: Namhyung Kim <[email protected]> AuthorDate: Fri, 5 Apr 2013 10:26:31 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 28 May 2013 16:23:55 +0300
perf sort: Reorder HISTC_SRCLINE index
It's in common sort dimension so it'd be more natural to place it with other common column index.
--- tools/perf/util/hist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/hist.h +1 -1
@@ -43,12 +43,12 @@ enum hist_column {HISTC_COMM ,HISTC_PARENT ,HISTC_CPU , +HISTC_SRCLINE ,HISTC_MISPREDICT ,HISTC_SYMBOL_FROM ,HISTC_SYMBOL_TO ,HISTC_DSO_FROM ,HISTC_DSO_TO , -HISTC_SRCLINE ,HISTC_LOCAL_WEIGHT ,HISTC_GLOBAL_WEIGHT , HISTC_MEM_DADDR_SYMBOL,
Namhyung Kim
maintainerPATCH 2/8 perf sort: Add 'addr' sort key
In reply to Namhyung KimFrom: Namhyung Kim <[email protected]>
New addr sort key provides a way to sort the entries by the symbol addresses. It can be helpful to figure out symbol resolution problem when a dso cannot do it properly as well as finding hotpath in a dso and/or a function.
--- tools/perf/util/hist.c | 2 ++ tools/perf/util/hist.h | 1 + tools/perf/util/sort.c | 29 +++++++++++++++++++++++++++++ tools/perf/util/sort.h | 1 + 4 files changed, 33 insertions(+)
tools/perf/util/hist.c +2 -0
@@ -52,6 +52,8 @@ void hists__reset_col_len(struct hists *hists)for (col =0 ; col <HISTC_NR_COLS ; ++col)hists__set_col_len (hists, col,0 ); + +hists__set_col_len (hists,HISTC_ADDR ,BITS_PER_LONG /4 +2 ); }static void hists__set_unres_dso_col_len (struct hists *hists,int dso)
tools/perf/util/hist.h +1 -0
@@ -44,6 +44,7 @@ enum hist_column {HISTC_PARENT ,HISTC_CPU ,HISTC_SRCLINE , +HISTC_ADDR ,HISTC_MISPREDICT ,HISTC_SYMBOL_FROM , HISTC_SYMBOL_TO,
tools/perf/util/sort.c +29 -0
@@ -343,6 +343,34 @@ struct sort_entry sort_cpu = { .se_width_idx = HISTC_CPU, }; +/* --sort addr */ + +static int64_t +sort__addr_cmp (struct hist_entry *left,struct hist_entry *right) +{ +return right->ip - left->ip; +} + +static int hist_entry__addr_snprintf (struct hist_entry *self,char *bf, +size_t size,unsigned int width) +{ +struct map *map = self->ms.map; +u64 addr = self->ip; + +if (map) + addr = map->unmap_ip (map, self->ip); + +return repsep_snprintf (bf, size,"%#*llx" , width, addr); +} + +struct sort_entry sort_addr = { + .se_header ="Address" , + .se_cmp = sort__addr_cmp, + .se_snprintf = hist_entry__addr_snprintf, + .se_width_idx =HISTC_ADDR , +}; + +/* sort keys for branch stacks */ static int64_t
@@ -872,6 +900,7 @@ static struct sort_dimension common_sort_dimensions[] = {DIM (SORT_PARENT ,"parent" , sort_parent),DIM (SORT_CPU ,"cpu" , sort_cpu),DIM (SORT_SRCLINE ,"srcline" , sort_srcline), + DIM(SORT_ADDR, "addr", sort_addr), };#undef DIM
tools/perf/util/sort.h +1 -0
@@ -138,6 +138,7 @@ enum sort_type {SORT_PARENT ,SORT_CPU ,SORT_SRCLINE , +SORT_ADDR ,/* branch stack specific sort keys */ __SORT_BRANCH_STACK,
Signature · 1 line
1.7.11.7
Namhyung Kim
maintainerPATCH 3/8 perf sort: Add 'addr_to/from' sort key
In reply to Namhyung KimFrom: Namhyung Kim <[email protected]>
New addr_{to,from} sort keys provide a way to sort the entries by the source/target symbol addresses.
--- tools/perf/util/hist.c | 2 ++ tools/perf/util/hist.h | 2 ++ tools/perf/util/sort.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/sort.h | 2 ++ 4 files changed, 54 insertions(+)
tools/perf/util/hist.c +2 -0
@@ -54,6 +54,8 @@ void hists__reset_col_len(struct hists *hists)hists__set_col_len (hists, col,0 );hists__set_col_len (hists,HISTC_ADDR ,BITS_PER_LONG /4 +2 ); +hists__set_col_len (hists,HISTC_ADDR_FROM ,BITS_PER_LONG /4 +2 ); +hists__set_col_len (hists,HISTC_ADDR_TO ,BITS_PER_LONG /4 +2 ); }static void hists__set_unres_dso_col_len (struct hists *hists,int dso)
tools/perf/util/hist.h +2 -0
@@ -50,6 +50,8 @@ enum hist_column {HISTC_SYMBOL_TO ,HISTC_DSO_FROM ,HISTC_DSO_TO , +HISTC_ADDR_FROM , +HISTC_ADDR_TO ,HISTC_LOCAL_WEIGHT ,HISTC_GLOBAL_WEIGHT , HISTC_MEM_DADDR_SYMBOL,
tools/perf/util/sort.c +48 -0
66 lines not on this page · raw message
tools/perf/util/sort.h +2 -0
@@ -146,6 +146,8 @@ enum sort_type {SORT_DSO_TO ,SORT_SYM_FROM ,SORT_SYM_TO , +SORT_ADDR_FROM , +SORT_ADDR_TO , SORT_MISPREDICT,/* memory mode specific sort keys */
Signature · 1 line
1.7.11.7
Namhyung Kim
maintainerPATCH 4/8 perf sort: Update documentation for sort keys
In reply to Namhyung KimFrom: Namhyung Kim <[email protected]>
Update and add missing description of new sort keys.
--- tools/perf/Documentation/perf-diff.txt | 2 +- tools/perf/Documentation/perf-report.txt | 5 ++++- tools/perf/Documentation/perf-top.txt | 2 +- tools/perf/builtin-diff.c | 2 +- tools/perf/builtin-report.c | 6 +++--- tools/perf/builtin-top.c | 3 ++- 6 files changed, 12 insertions(+), 8 deletions(-)
tools/perf/Documentation/perf-diff.txt +1 -1
@@ -47,7 +47,7 @@ OPTIONS -s:: --sort=:: - Sort by key(s): pid, comm, dso, symbol. + Sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, addr. -t:: --field-separator=::
tools/perf/Documentation/perf-report.txt +4 -1
@@ -59,7 +59,7 @@ OPTIONS --sort=:: Sort histogram entries by given key(s) - multiple keys can be specified in CSV format. Following sort keys are available: - pid, comm, dso, symbol, parent, cpu, srcline, weight, local_weight. + pid, comm, dso, symbol, parent, cpu, srcline, addr. Each key has following meaning:
@@ -72,6 +72,7 @@ OPTIONS - cpu: cpu number the task ran at the time of sample - srcline: filename and line number executed at the time of sample. The DWARF debuggin info must be provided. + - addr: address of function executed at the time of sample By default, comm, dso and symbol keys are used. (i.e. --sort comm,dso,symbol)
@@ -84,6 +85,8 @@ OPTIONS - dso_to: name of library or module branched to - symbol_from: name of function branched from - symbol_to: name of function branched to + - addr_from: address of function branched from + - addr_to: address of function branched to - mispredict: "N" for predicted branch, "Y" for mispredicted branch And default sort keys are changed to comm, dso_from, symbol_from, dso_to
tools/perf/Documentation/perf-top.txt +1 -1
@@ -112,7 +112,7 @@ Default is to monitor all CPUS. -s:: --sort:: - Sort by key(s): pid, comm, dso, symbol, parent, srcline, weight, local_weight. + Sort by key(s): pid, comm, dso, symbol, parent, srcline, cpu, addr. -n:: --show-nr-samples::
tools/perf/builtin-diff.c +1 -1
@@ -542,7 +542,7 @@ static const struct option options[] = {OPT_STRING ('S' ,"symbols" , &symbol_conf.sym_list_str,"symbol[,symbol...]" ,"only consider these symbols" ),OPT_STRING ('s' ,"sort" , &sort_order,"key[,key2...]" , -"sort by key(s): pid, comm, dso, symbol, parent" ), +"sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, addr" ),OPT_STRING ('t' ,"field-separator" , &symbol_conf.field_sep,"separator" ,"separator for columns, no spaces will be added between " "columns '.' is reserved."),
tools/perf/builtin-report.c +3 -3
@@ -756,9 +756,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) "Use the stdio interface"),OPT_STRING ('s' ,"sort" , &sort_order,"key[,key2...]" ,"sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline," -" dso_to, dso_from, symbol_to, symbol_from, mispredict," -" weight, local_weight, mem, symbol_daddr, dso_daddr, tlb, " -"snoop, locked" ), +" addr, dso_to, dso_from, symbol_to, symbol_from, addr_to," +" addr_from, mispredict, weight, local_weight, mem," +" symbol_daddr, dso_daddr, tlb, snoop, locked" ),OPT_BOOLEAN (0 ,"showcpuutilization" , &symbol_conf.show_cpu_utilization,"Show sample percentage for different cpu modes" ), OPT_STRING('p', "parent", &parent_pattern, "regex",
tools/perf/builtin-top.c +2 -1
@@ -1089,7 +1089,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)OPT_INCR ('v' ,"verbose" , &verbose,"be more verbose (show counter open errors, etc)" ),OPT_STRING ('s' ,"sort" , &sort_order,"key[,key2...]" , -"sort by key(s): pid, comm, dso, symbol, parent, weight, local_weight" ), +"sort by key(s): pid, comm, dso, symbol, parent, cpu," +" srcline, addr" ),OPT_BOOLEAN ('n' ,"show-nr-samples" , &symbol_conf.show_nr_samples,"Show a column with the number of samples" ), OPT_CALLBACK_DEFAULT('G', "call-graph", &top.record_opts,
Signature · 1 line
1.7.11.7
Namhyung Kim
maintainerPATCH 5/8 perf hists: Move column length setting code
In reply to Namhyung KimFrom: Namhyung Kim <[email protected]>
They are set to constant length so no need to update every time.
--- tools/perf/util/hist.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
tools/perf/util/hist.c +6 -7
@@ -56,6 +56,12 @@ void hists__reset_col_len(struct hists *hists)hists__set_col_len (hists,HISTC_ADDR ,BITS_PER_LONG /4 +2 );hists__set_col_len (hists,HISTC_ADDR_FROM ,BITS_PER_LONG /4 +2 );hists__set_col_len (hists,HISTC_ADDR_TO ,BITS_PER_LONG /4 +2 ); +hists__set_col_len (hists,HISTC_LOCAL_WEIGHT ,12 ); +hists__set_col_len (hists,HISTC_GLOBAL_WEIGHT ,12 ); +hists__set_col_len (hists,HISTC_MEM_LOCKED ,6 ); +hists__set_col_len (hists,HISTC_MEM_TLB ,22 ); +hists__set_col_len (hists,HISTC_MEM_SNOOP ,12 ); +hists__set_col_len (hists,HISTC_MEM_LVL ,21 +3 ); }static void hists__set_unres_dso_col_len (struct hists *hists,int dso)
@@ -156,13 +162,6 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)hists__new_col_len (hists,HISTC_MEM_DADDR_SYMBOL , symlen);hists__set_unres_dso_col_len (hists,HISTC_MEM_DADDR_DSO ); } - -hists__new_col_len (hists,HISTC_MEM_LOCKED ,6 ); -hists__new_col_len (hists,HISTC_MEM_TLB ,22 ); -hists__new_col_len (hists,HISTC_MEM_SNOOP ,12 ); -hists__new_col_len (hists,HISTC_MEM_LVL ,21 +3 ); -hists__new_col_len (hists,HISTC_LOCAL_WEIGHT ,12 ); -hists__new_col_len (hists,HISTC_GLOBAL_WEIGHT ,12 ); }void hists__output_recalc_col_len (struct hists *hists,int max_rows)
Signature · 1 line
1.7.11.7
Namhyung Kim
maintainerPATCH 6/8 perf sort: Cleanup sort__has_sym setting
In reply to Namhyung KimFrom: Namhyung Kim <[email protected]>
The sort__has_sym variable is set only if a symbol-related sort key was added. Since branch stack and memory sort dimensions are separated, it doesn't need to be checked from common dimension.
--- tools/perf/util/sort.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
tools/perf/util/sort.c +1 -4
@@ -1015,10 +1015,7 @@ int sort_dimension__add(const char *tok)return -EINVAL ; } sort__has_parent =1 ; - }else if (sd->entry == &sort_sym || - sd->entry == &sort_sym_from || - sd->entry == &sort_sym_to || - sd->entry == &sort_mem_daddr_sym) { + }else if (sd->entry == &sort_sym) { sort__has_sym =1 ; }
Signature · 1 line
1.7.11.7
tip-bot for Namhyung Kim
merge bot[tip:perf/core] perf sort: Cleanup sort__has_sym setting
perf sort: Cleanup sort__has_sym setting
Commit-ID: 930477bdc227adbbff1d42ec9eba50a805cc9b78 Gitweb: http://git.kernel.org/tip/930477bdc227adbbff1d42ec9eba50a805cc9b78 Author: Namhyung Kim <[email protected]> AuthorDate: Fri, 5 Apr 2013 10:26:36 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 28 May 2013 16:23:56 +0300
perf sort: Cleanup sort__has_sym setting
The sort__has_sym variable is set only if a symbol-related sort key was added. Since branch stack and memory sort dimensions are separated, it doesn't need to be checked from common dimension.
--- tools/perf/util/sort.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
tools/perf/util/sort.c +1 -4
@@ -938,10 +938,7 @@ int sort_dimension__add(const char *tok)return -EINVAL ; } sort__has_parent =1 ; - }else if (sd->entry == &sort_sym || - sd->entry == &sort_sym_from || - sd->entry == &sort_sym_to || - sd->entry == &sort_mem_daddr_sym) { + }else if (sd->entry == &sort_sym) { sort__has_sym =1 ; }
Namhyung Kim
maintainerPATCH 7/8 perf top: Use sort__has_sym
In reply to Namhyung KimFrom: Namhyung Kim <[email protected]>
perf top had a similar variable sort_has_symbols for the same purpose.
--- tools/perf/builtin-top.c | 12 +++--------- tools/perf/util/top.h | 1 - 2 files changed, 3 insertions(+), 10 deletions(-)
tools/perf/builtin-top.c +3 -9
@@ -794,7 +794,7 @@ static void perf_event__process_sample(struct perf_tool *tool,return ; } -if (top->sort_has_symbols) +if (sort__has_sym)perf_top__record_precise_ip (top, he, evsel->idx, ip); }
@@ -912,9 +912,9 @@ out_err:return -1 ; } -static int perf_top__setup_sample_type (struct perf_top *top) +static int perf_top__setup_sample_type (struct perf_top *top__maybe_unused ) { -if (!top->sort_has_symbols) { +if (!sort__has_sym) {if (symbol_conf.use_callchain) {ui__error ("Selected -g but \"sym\" not present in --sort/-s." );return -EINVAL ;
@@ -1203,12 +1203,6 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)sort__setup_elide (stdout); -/* -* Avoid annotation data structures overhead when symbols aren't on the -* sort list. -*/ - top.sort_has_symbols = sort_sym.list.next !=NULL ; -get_term_dimensions (&top.winsize);if (top.print_entries ==0 ) {struct sigaction act = {
tools/perf/util/top.h +0 -1
@@ -26,7 +26,6 @@ struct perf_top {int print_entries, count_filter, delay_secs;bool hide_kernel_symbols, hide_user_symbols, zero;bool use_tui, use_stdio; -bool sort_has_symbols;bool kptr_restrict_warned;bool vmlinux_warned;bool dump_symtab;
Signature · 1 line
1.7.11.7
tip-bot for Namhyung Kim
merge bot[tip:perf/core] perf top: Use sort__has_sym
perf top: Use sort__has_sym
Commit-ID: 8f0f684b7b640caeca319f7f4e18474d099d8606 Gitweb: http://git.kernel.org/tip/8f0f684b7b640caeca319f7f4e18474d099d8606 Author: Namhyung Kim <[email protected]> AuthorDate: Fri, 5 Apr 2013 10:26:37 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 28 May 2013 16:23:56 +0300
perf top: Use sort__has_sym
perf top had a similar variable sort_has_symbols for the same purpose.
--- tools/perf/builtin-top.c | 12 +++--------- tools/perf/util/top.h | 1 - 2 files changed, 3 insertions(+), 10 deletions(-)
tools/perf/builtin-top.c +3 -9
@@ -794,7 +794,7 @@ static void perf_event__process_sample(struct perf_tool *tool,return ; } -if (top->sort_has_symbols) +if (sort__has_sym)perf_top__record_precise_ip (top, he, evsel->idx, ip); }
@@ -912,9 +912,9 @@ out_err:return -1 ; } -static int perf_top__setup_sample_type (struct perf_top *top) +static int perf_top__setup_sample_type (struct perf_top *top__maybe_unused ) { -if (!top->sort_has_symbols) { +if (!sort__has_sym) {if (symbol_conf.use_callchain) {ui__error ("Selected -g but \"sym\" not present in --sort/-s." );return -EINVAL ;
@@ -1202,12 +1202,6 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)sort__setup_elide (stdout); -/* -* Avoid annotation data structures overhead when symbols aren't on the -* sort list. -*/ - top.sort_has_symbols = sort_sym.list.next !=NULL ; -get_term_dimensions (&top.winsize);if (top.print_entries ==0 ) {struct sigaction act = {
tools/perf/util/top.h +0 -1
@@ -26,7 +26,6 @@ struct perf_top {int print_entries, count_filter, delay_secs;bool hide_kernel_symbols, hide_user_symbols, zero;bool use_tui, use_stdio; -bool sort_has_symbols;bool kptr_restrict_warned;bool vmlinux_warned;bool dump_symtab;
Namhyung Kim
maintainerPATCH 8/8 perf hist browser: Use sort__has_sym
In reply to Namhyung KimFrom: Namhyung Kim <[email protected]>
The TUI hist browser had a similar variable has_symbols for the same purpose. Let's get rid of the duplication.
--- tools/perf/ui/browsers/hists.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
tools/perf/ui/browsers/hists.c +2 -7
@@ -25,7 +25,6 @@ struct hist_browser {struct map_symbol *selection;int print_seq;bool show_dso; -bool has_symbols; };extern void hist_browser__init_hpp (void );
@@ -1155,10 +1154,6 @@ static struct hist_browser *hist_browser__new(struct hists *hists) browser->b.refresh = hist_browser__refresh; browser->b.seek = ui_browser__hists_seek; browser->b.use_navkeypressed = true; -if (sort__mode ==SORT_MODE__BRANCH ) - browser->has_symbols = sort_sym_from.list.next !=NULL ; -else - browser->has_symbols = sort_sym.list.next !=NULL ; }return browser;
@@ -1386,7 +1381,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,*/ goto out_free_stack;case 'a' : -if (!browser->has_symbols) { +if (!sort__has_sym) {ui_browser__warning (&browser->b, delay_secs *2 ,"Annotation is only available for symbolic views, " "include \"sym*\" in --sort to use it." );
@@ -1485,7 +1480,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,continue ; } -if (!browser->has_symbols) +if (!sort__has_sym) goto add_exit_option;if (sort__mode ==SORT_MODE__BRANCH ) {
Signature · 1 line
1.7.11.7
tip-bot for Arnaldo Carvalho de Melo
merge bot[tip:perf/core] perf hists browser: Use sort__has_sym
perf hists browser: Use sort__has_sym
Commit-ID: 9c796ec8dbc8dbfe41ce35a1ccb1b59b47148daf Gitweb: http://git.kernel.org/tip/9c796ec8dbc8dbfe41ce35a1ccb1b59b47148daf Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Fri, 26 Apr 2013 14:28:46 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 28 May 2013 16:23:56 +0300
perf hists browser: Use sort__has_sym
The TUI hist browser had a similar variable has_symbols for the same purpose. Let's get rid of the duplication.
--- tools/perf/ui/browsers/hists.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
tools/perf/ui/browsers/hists.c +2 -7
@@ -25,7 +25,6 @@ struct hist_browser {struct map_symbol *selection;int print_seq;bool show_dso; -bool has_symbols; };extern void hist_browser__init_hpp (void );
@@ -1155,10 +1154,6 @@ static struct hist_browser *hist_browser__new(struct hists *hists) browser->b.refresh = hist_browser__refresh; browser->b.seek = ui_browser__hists_seek; browser->b.use_navkeypressed = true; -if (sort__mode ==SORT_MODE__BRANCH ) - browser->has_symbols = sort_sym_from.list.next !=NULL ; -else - browser->has_symbols = sort_sym.list.next !=NULL ; }return browser;
@@ -1386,7 +1381,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,*/ goto out_free_stack;case 'a' : -if (!browser->has_symbols) { +if (!sort__has_sym) {ui_browser__warning (&browser->b, delay_secs *2 ,"Annotation is only available for symbolic views, " "include \"sym*\" in --sort to use it." );
@@ -1485,7 +1480,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,continue ; } -if (!browser->has_symbols) +if (!sort__has_sym) goto add_exit_option;if (sort__mode ==SORT_MODE__BRANCH ) {