Skip to content

Commit 68aac85

Browse files
Ravi Bangoriaacmel
authored andcommitted
perf annotate: Fix --show-total-period for tui/stdio2
perf annotate --show-total-period does not really show total period. The reason is we have two separate variables for the same purpose. One is in symbol_conf.show_total_period and another is annotation_options.show_total_period. We save command line option in symbol_conf.show_total_period but uses annotation_option.show_total_period while rendering tui/stdio2 browser. Though, we copy symbol_conf.show_total_period to annotation__default_options.show_total_period but that is not really effective as we don't use annotation__default_options once we copy default options to dynamic variable annotate.opts in cmd_annotate(). Instead of all these complication, keep only one variable and use it all over. symbol_conf.show_total_period is used by perf report/top as well. So let's kill annotation_options.show_total_period. On a side note, I've kept annotation_options.show_total_period definition because it's still used by perf-config code. Follow up patch to fix perf-config for annotate will remove annotation_options.show_total_period. Signed-off-by: Ravi Bangoria <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexey Budankov <[email protected]> Cc: Changbin Du <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Leo Yan <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Song Liu <[email protected]> Cc: Taeung Song <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Yisheng Xie <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 54cf752 commit 68aac85

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

tools/perf/ui/browsers/annotate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,13 +833,13 @@ static int annotate_browser__run(struct annotate_browser *browser,
833833
map_symbol__annotation_dump(ms, evsel, browser->opts);
834834
continue;
835835
case 't':
836-
if (notes->options->show_total_period) {
837-
notes->options->show_total_period = false;
836+
if (symbol_conf.show_total_period) {
837+
symbol_conf.show_total_period = false;
838838
notes->options->show_nr_samples = true;
839839
} else if (notes->options->show_nr_samples)
840840
notes->options->show_nr_samples = false;
841841
else
842-
notes->options->show_total_period = true;
842+
symbol_conf.show_total_period = true;
843843
annotation__update_column_widths(notes);
844844
continue;
845845
case 'c':

tools/perf/util/annotate.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2915,7 +2915,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
29152915
percent = annotation_data__percent(&al->data[i], percent_type);
29162916

29172917
obj__set_percent_color(obj, percent, current_entry);
2918-
if (notes->options->show_total_period) {
2918+
if (symbol_conf.show_total_period) {
29192919
obj__printf(obj, "%11" PRIu64 " ", al->data[i].he.period);
29202920
} else if (notes->options->show_nr_samples) {
29212921
obj__printf(obj, "%6" PRIu64 " ",
@@ -2931,7 +2931,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
29312931
obj__printf(obj, "%-*s", pcnt_width, " ");
29322932
else {
29332933
obj__printf(obj, "%-*s", pcnt_width,
2934-
notes->options->show_total_period ? "Period" :
2934+
symbol_conf.show_total_period ? "Period" :
29352935
notes->options->show_nr_samples ? "Samples" : "Percent");
29362936
}
29372937
}
@@ -3155,7 +3155,6 @@ void annotation_config__init(void)
31553155
{
31563156
perf_config(annotation__config, NULL);
31573157

3158-
annotation__default_options.show_total_period = symbol_conf.show_total_period;
31593158
annotation__default_options.show_nr_samples = symbol_conf.show_nr_samples;
31603159
}
31613160

tools/perf/util/annotate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ static inline int annotation__cycles_width(struct annotation *notes)
309309

310310
static inline int annotation__pcnt_width(struct annotation *notes)
311311
{
312-
return (notes->options->show_total_period ? 12 : 7) * notes->nr_events;
312+
return (symbol_conf.show_total_period ? 12 : 7) * notes->nr_events;
313313
}
314314

315315
static inline bool annotation_line__filter(struct annotation_line *al, struct annotation *notes)

0 commit comments

Comments
 (0)