aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-05-03 07:54:44 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-05-05 20:03:59 -0400
commit2e0453af4e16e97268b9e66aad37beb607ed7c0f (patch)
treef63df0eb99cf9dd0250d4ebc5b632e7043c394f8
parentde7e6a7c8bf9ee46dcbee749bc3cdd0d9c21998a (diff)
perf hists: Move sort__has_sym into struct perf_hpp_list
Now we have sort dimensions private for struct hists, we need to make dimension booleans hists specific as well. Moving sort__has_sym into struct perf_hpp_list. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1462276488-26683-4-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-top.c4
-rw-r--r--tools/perf/ui/browsers/hists.c6
-rw-r--r--tools/perf/ui/gtk/hists.c2
-rw-r--r--tools/perf/ui/hist.c2
-rw-r--r--tools/perf/util/annotate.c2
-rw-r--r--tools/perf/util/hist.h1
-rw-r--r--tools/perf/util/sort.c9
-rw-r--r--tools/perf/util/sort.h1
8 files changed, 13 insertions, 14 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index ff6109839cdd..39fe06fc19d3 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -688,7 +688,7 @@ static int hist_iter__top_callback(struct hist_entry_iter *iter,
688 struct hist_entry *he = iter->he; 688 struct hist_entry *he = iter->he;
689 struct perf_evsel *evsel = iter->evsel; 689 struct perf_evsel *evsel = iter->evsel;
690 690
691 if (sort__has_sym && single) 691 if (perf_hpp_list.sym && single)
692 perf_top__record_precise_ip(top, he, evsel->idx, al->addr); 692 perf_top__record_precise_ip(top, he, evsel->idx, al->addr);
693 693
694 hist__account_cycles(iter->sample->branch_stack, al, iter->sample, 694 hist__account_cycles(iter->sample->branch_stack, al, iter->sample,
@@ -919,7 +919,7 @@ out_err:
919 919
920static int callchain_param__setup_sample_type(struct callchain_param *callchain) 920static int callchain_param__setup_sample_type(struct callchain_param *callchain)
921{ 921{
922 if (!sort__has_sym) { 922 if (!perf_hpp_list.sym) {
923 if (callchain->enabled) { 923 if (callchain->enabled) {
924 ui__error("Selected -g but \"sym\" not present in --sort/-s."); 924 ui__error("Selected -g but \"sym\" not present in --sort/-s.");
925 return -EINVAL; 925 return -EINVAL;
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 6a4681932ba5..b66bf83ed883 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2747,7 +2747,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
2747 */ 2747 */
2748 goto out_free_stack; 2748 goto out_free_stack;
2749 case 'a': 2749 case 'a':
2750 if (!sort__has_sym) { 2750 if (!hists__has(hists, sym)) {
2751 ui_browser__warning(&browser->b, delay_secs * 2, 2751 ui_browser__warning(&browser->b, delay_secs * 2,
2752 "Annotation is only available for symbolic views, " 2752 "Annotation is only available for symbolic views, "
2753 "include \"sym*\" in --sort to use it."); 2753 "include \"sym*\" in --sort to use it.");
@@ -2910,7 +2910,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
2910 continue; 2910 continue;
2911 } 2911 }
2912 2912
2913 if (!sort__has_sym || browser->selection == NULL) 2913 if (!hists__has(hists, sym) || browser->selection == NULL)
2914 goto skip_annotation; 2914 goto skip_annotation;
2915 2915
2916 if (sort__mode == SORT_MODE__BRANCH) { 2916 if (sort__mode == SORT_MODE__BRANCH) {
@@ -2969,7 +2969,7 @@ skip_annotation:
2969 * 2969 *
2970 * See hist_browser__show_entry. 2970 * See hist_browser__show_entry.
2971 */ 2971 */
2972 if (sort__has_sym && browser->selection->sym) { 2972 if (hists__has(hists, sym) && browser->selection->sym) {
2973 nr_options += add_script_opt(browser, 2973 nr_options += add_script_opt(browser,
2974 &actions[nr_options], 2974 &actions[nr_options],
2975 &options[nr_options], 2975 &options[nr_options],
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 2aa45b606fa4..932adfaa05af 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -379,7 +379,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
379 gtk_tree_store_set(store, &iter, col_idx++, s, -1); 379 gtk_tree_store_set(store, &iter, col_idx++, s, -1);
380 } 380 }
381 381
382 if (symbol_conf.use_callchain && sort__has_sym) { 382 if (symbol_conf.use_callchain && hists__has(hists, sym)) {
383 if (callchain_param.mode == CHAIN_GRAPH_REL) 383 if (callchain_param.mode == CHAIN_GRAPH_REL)
384 total = symbol_conf.cumulate_callchain ? 384 total = symbol_conf.cumulate_callchain ?
385 h->stat_acc->period : h->stat.period; 385 h->stat_acc->period : h->stat.period;
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 3baeaa6e71b5..af07ffb129ca 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -635,7 +635,7 @@ unsigned int hists__sort_list_width(struct hists *hists)
635 ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists)); 635 ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists));
636 } 636 }
637 637
638 if (verbose && sort__has_sym) /* Addr + origin */ 638 if (verbose && hists__has(hists, sym)) /* Addr + origin */
639 ret += 3 + BITS_PER_LONG / 4; 639 ret += 3 + BITS_PER_LONG / 4;
640 640
641 return ret; 641 return ret;
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index b795b6994144..d4b3d034c503 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1665,5 +1665,5 @@ int hist_entry__annotate(struct hist_entry *he, size_t privsize)
1665 1665
1666bool ui__has_annotation(void) 1666bool ui__has_annotation(void)
1667{ 1667{
1668 return use_browser == 1 && sort__has_sym; 1668 return use_browser == 1 && perf_hpp_list.sym;
1669} 1669}
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 57b09791c339..c3a77502e22b 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -243,6 +243,7 @@ struct perf_hpp_list {
243 243
244 int need_collapse; 244 int need_collapse;
245 int parent; 245 int parent;
246 int sym;
246}; 247};
247 248
248extern struct perf_hpp_list perf_hpp_list; 249extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 75b33d387f50..544ab376ac42 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char *sort_order;
21const char *field_order; 21const char *field_order;
22regex_t ignore_callees_regex; 22regex_t ignore_callees_regex;
23int have_ignore_callees = 0; 23int have_ignore_callees = 0;
24int sort__has_sym = 0;
25int sort__has_dso = 0; 24int sort__has_dso = 0;
26int sort__has_socket = 0; 25int sort__has_socket = 0;
27int sort__has_thread = 0; 26int sort__has_thread = 0;
@@ -2245,7 +2244,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
2245 } 2244 }
2246 list->parent = 1; 2245 list->parent = 1;
2247 } else if (sd->entry == &sort_sym) { 2246 } else if (sd->entry == &sort_sym) {
2248 sort__has_sym = 1; 2247 list->sym = 1;
2249 /* 2248 /*
2250 * perf diff displays the performance difference amongst 2249 * perf diff displays the performance difference amongst
2251 * two or more perf.data files. Those files could come 2250 * two or more perf.data files. Those files could come
@@ -2287,7 +2286,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
2287 return -EINVAL; 2286 return -EINVAL;
2288 2287
2289 if (sd->entry == &sort_sym_from || sd->entry == &sort_sym_to) 2288 if (sd->entry == &sort_sym_from || sd->entry == &sort_sym_to)
2290 sort__has_sym = 1; 2289 list->sym = 1;
2291 2290
2292 __sort_dimension__add(sd, list, level); 2291 __sort_dimension__add(sd, list, level);
2293 return 0; 2292 return 0;
@@ -2303,7 +2302,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
2303 return -EINVAL; 2302 return -EINVAL;
2304 2303
2305 if (sd->entry == &sort_mem_daddr_sym) 2304 if (sd->entry == &sort_mem_daddr_sym)
2306 sort__has_sym = 1; 2305 list->sym = 1;
2307 2306
2308 __sort_dimension__add(sd, list, level); 2307 __sort_dimension__add(sd, list, level);
2309 return 0; 2308 return 0;
@@ -2746,7 +2745,7 @@ void reset_output_field(void)
2746{ 2745{
2747 perf_hpp_list.need_collapse = 0; 2746 perf_hpp_list.need_collapse = 0;
2748 perf_hpp_list.parent = 0; 2747 perf_hpp_list.parent = 0;
2749 sort__has_sym = 0; 2748 perf_hpp_list.sym = 0;
2750 sort__has_dso = 0; 2749 sort__has_dso = 0;
2751 2750
2752 field_order = NULL; 2751 field_order = NULL;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 0e44aea86800..9a5e7d4a2cac 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -32,7 +32,6 @@ extern const char default_sort_order[];
32extern regex_t ignore_callees_regex; 32extern regex_t ignore_callees_regex;
33extern int have_ignore_callees; 33extern int have_ignore_callees;
34extern int sort__has_dso; 34extern int sort__has_dso;
35extern int sort__has_sym;
36extern int sort__has_socket; 35extern int sort__has_socket;
37extern int sort__has_thread; 36extern int sort__has_thread;
38extern int sort__has_comm; 37extern int sort__has_comm;