From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
To: acme@kernel.org, jolsa@redhat.com
Cc: xieyisheng1@huawei.com, alexey.budankov@linux.intel.com,
treeze.taeung@gmail.com, adrian.hunter@intel.com,
tmricht@linux.ibm.com, namhyung@kernel.org, irogers@google.com,
songliubraving@fb.com, yao.jin@linux.intel.com,
changbin.du@intel.com, leo.yan@linaro.org,
linux-kernel@vger.kernel.org,
Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Subject: [PATCH 2/8] perf annotate: Fix --show-total-period for tui/stdio2
Date: Thu, 13 Feb 2020 12:13:00 +0530 [thread overview]
Message-ID: <20200213064306.160480-3-ravi.bangoria@linux.ibm.com> (raw)
In-Reply-To: <20200213064306.160480-1-ravi.bangoria@linux.ibm.com>
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 <ravi.bangoria@linux.ibm.com>
---
tools/perf/ui/browsers/annotate.c | 6 +++---
tools/perf/util/annotate.c | 5 ++---
tools/perf/util/annotate.h | 2 +-
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 0dbbf35e6ed1..7e5b44becb5c 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -833,13 +833,13 @@ static int annotate_browser__run(struct annotate_browser *browser,
map_symbol__annotation_dump(ms, evsel, browser->opts);
continue;
case 't':
- if (notes->options->show_total_period) {
- notes->options->show_total_period = false;
+ if (symbol_conf.show_total_period) {
+ symbol_conf.show_total_period = false;
notes->options->show_nr_samples = true;
} else if (notes->options->show_nr_samples)
notes->options->show_nr_samples = false;
else
- notes->options->show_total_period = true;
+ symbol_conf.show_total_period = true;
annotation__update_column_widths(notes);
continue;
case 'c':
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index b2a26adeb4cd..c0c3832e3789 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -2892,7 +2892,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
percent = annotation_data__percent(&al->data[i], percent_type);
obj__set_percent_color(obj, percent, current_entry);
- if (notes->options->show_total_period) {
+ if (symbol_conf.show_total_period) {
obj__printf(obj, "%11" PRIu64 " ", al->data[i].he.period);
} else if (notes->options->show_nr_samples) {
obj__printf(obj, "%6" PRIu64 " ",
@@ -2908,7 +2908,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
obj__printf(obj, "%-*s", pcnt_width, " ");
else {
obj__printf(obj, "%-*s", pcnt_width,
- notes->options->show_total_period ? "Period" :
+ symbol_conf.show_total_period ? "Period" :
notes->options->show_nr_samples ? "Samples" : "Percent");
}
}
@@ -3132,7 +3132,6 @@ void annotation_config__init(void)
{
perf_config(annotation__config, NULL);
- annotation__default_options.show_total_period = symbol_conf.show_total_period;
annotation__default_options.show_nr_samples = symbol_conf.show_nr_samples;
}
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 2f333dfb586d..632e28b67990 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -307,7 +307,7 @@ static inline int annotation__cycles_width(struct annotation *notes)
static inline int annotation__pcnt_width(struct annotation *notes)
{
- return (notes->options->show_total_period ? 12 : 7) * notes->nr_events;
+ return (symbol_conf.show_total_period ? 12 : 7) * notes->nr_events;
}
static inline bool annotation_line__filter(struct annotation_line *al, struct annotation *notes)
--
2.24.1
next prev parent reply other threads:[~2020-02-13 6:44 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 6:42 [PATCH 0/8] perf annotate/config: More fixes Ravi Bangoria
2020-02-13 6:42 ` [PATCH 1/8] perf annotate/tui: Re-render title bar after switching back from script browser Ravi Bangoria
2020-02-27 13:11 ` Arnaldo Carvalho de Melo
2020-02-29 9:16 ` [tip: perf/urgent] " tip-bot2 for Ravi Bangoria
2020-02-13 6:43 ` Ravi Bangoria [this message]
2020-02-27 13:14 ` [PATCH 2/8] perf annotate: Fix --show-total-period for tui/stdio2 Arnaldo Carvalho de Melo
2020-02-29 9:16 ` [tip: perf/urgent] " tip-bot2 for Ravi Bangoria
2020-02-13 6:43 ` [PATCH 3/8] perf annotate: Fix --show-nr-samples " Ravi Bangoria
2020-02-29 9:16 ` [tip: perf/urgent] " tip-bot2 for Ravi Bangoria
2020-02-13 6:43 ` [PATCH 4/8] perf config: Introduce perf_config_u8() Ravi Bangoria
2020-02-29 9:16 ` [tip: perf/urgent] " tip-bot2 for Ravi Bangoria
2020-02-13 6:43 ` [PATCH 5/8] perf annotate: Make perf config effective Ravi Bangoria
2020-02-27 13:32 ` Arnaldo Carvalho de Melo
2020-02-29 9:16 ` [tip: perf/urgent] " tip-bot2 for Ravi Bangoria
2020-02-13 6:43 ` [PATCH 6/8] perf annotate: Prefer cmdline option over default config Ravi Bangoria
2020-02-29 9:16 ` [tip: perf/urgent] " tip-bot2 for Ravi Bangoria
2020-02-13 6:43 ` [PATCH 7/8] perf annotate: Fix perf config option description Ravi Bangoria
2020-02-29 9:16 ` [tip: perf/urgent] " tip-bot2 for Ravi Bangoria
2020-02-13 6:43 ` [PATCH 8/8] perf config: Document missing config options Ravi Bangoria
2020-02-29 9:16 ` [tip: perf/urgent] " tip-bot2 for Ravi Bangoria
2020-02-16 21:15 ` [PATCH 0/8] perf annotate/config: More fixes Jiri Olsa
2020-02-17 13:02 ` Ravi Bangoria
2020-02-27 13:08 ` Arnaldo Carvalho de Melo
2020-02-27 13:16 ` Jiri Olsa
2020-02-27 13:43 ` Arnaldo Carvalho de Melo
2020-02-27 13:39 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200213064306.160480-3-ravi.bangoria@linux.ibm.com \
--to=ravi.bangoria@linux.ibm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexey.budankov@linux.intel.com \
--cc=changbin.du@intel.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=songliubraving@fb.com \
--cc=tmricht@linux.ibm.com \
--cc=treeze.taeung@gmail.com \
--cc=xieyisheng1@huawei.com \
--cc=yao.jin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).