Skip to content

Commit 46ccb44

Browse files
Ravi Bangoriaacmel
authored andcommitted
perf annotate: Fix --show-nr-samples for tui/stdio2
perf annotate --show-nr-samples does not really show number of samples. The reason is we have two separate variables for the same purpose. One is in symbol_conf.show_nr_samples and another is annotation_options.show_nr_samples. We save command line option in symbol_conf.show_nr_samples but uses annotation_option.show_nr_samples while rendering tui/stdio2 browser. Though, we copy symbol_conf.show_nr_samples to annotation__default_options.show_nr_samples 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_nr_samples is used by perf report/top as well. So let's kill annotation_options.show_nr_samples. On a side note, I've kept annotation_options.show_nr_samples definition because it's still used by perf-config code. Follow up patch to fix perf-config for annotate will remove annotation_options.show_nr_samples. 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 68aac85 commit 46ccb44

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

tools/perf/ui/browsers/annotate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -835,9 +835,9 @@ static int annotate_browser__run(struct annotate_browser *browser,
835835
case 't':
836836
if (symbol_conf.show_total_period) {
837837
symbol_conf.show_total_period = false;
838-
notes->options->show_nr_samples = true;
839-
} else if (notes->options->show_nr_samples)
840-
notes->options->show_nr_samples = false;
838+
symbol_conf.show_nr_samples = true;
839+
} else if (symbol_conf.show_nr_samples)
840+
symbol_conf.show_nr_samples = false;
841841
else
842842
symbol_conf.show_total_period = true;
843843
annotation__update_column_widths(notes);

tools/perf/util/annotate.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2917,7 +2917,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
29172917
obj__set_percent_color(obj, percent, current_entry);
29182918
if (symbol_conf.show_total_period) {
29192919
obj__printf(obj, "%11" PRIu64 " ", al->data[i].he.period);
2920-
} else if (notes->options->show_nr_samples) {
2920+
} else if (symbol_conf.show_nr_samples) {
29212921
obj__printf(obj, "%6" PRIu64 " ",
29222922
al->data[i].he.nr_samples);
29232923
} else {
@@ -2932,7 +2932,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
29322932
else {
29332933
obj__printf(obj, "%-*s", pcnt_width,
29342934
symbol_conf.show_total_period ? "Period" :
2935-
notes->options->show_nr_samples ? "Samples" : "Percent");
2935+
symbol_conf.show_nr_samples ? "Samples" : "Percent");
29362936
}
29372937
}
29382938

@@ -3154,8 +3154,6 @@ static int annotation__config(const char *var, const char *value,
31543154
void annotation_config__init(void)
31553155
{
31563156
perf_config(annotation__config, NULL);
3157-
3158-
annotation__default_options.show_nr_samples = symbol_conf.show_nr_samples;
31593157
}
31603158

31613159
static unsigned int parse_percent_type(char *str1, char *str2)

0 commit comments

Comments
 (0)