Skip to contentSkip to conversation

perf annotate browser: Show the proper header when using --show-total-period

PATCH In review Taeung Song 2 participants 2 messages Jul 27, 2017 – Jul 30, 2017 perf events

lore
Share & tools
lore
#0 lore raw

PATCH v4 4/9 perf annotate browser: Show the proper header when using --show-total-period

Currently a first column is only "Percent",
so fix it to show correct column name based on given options. (e.g. if using --show-total-period or a 't' hotkey, show "Event count" as a first column)

---
 tools/perf/ui/browsers/annotate.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/ui/browsers/annotate.c +6 -2
index 87b0395..9fd4413 100644
@@ -165,8 +165,12 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
 
 		if (!show_title)
 			ui_browser__write_nstring(browser, " ", pcnt_width);
-		else
-			ui_browser__printf(browser, "%*s", 7, "Percent");
+		else  {
+			if (annotate_browser__opts.show_total_period)
+				ui_browser__printf(browser, "%*s", 11, "Event count");
+			else
+				ui_browser__printf(browser, "%*s", 7, "Percent");
+		}
 	}
 	if (ab->have_cycles) {
 		if (dl->ipc)
Signature · 1 line
2.7.4
#1 lore raw

[tip:perf/core] perf annotate TUI: Fix column header when toggling period/percent

perf annotate TUI: Fix column header when toggling period/percent
Commit-ID:  f67d395c6e3895c3c8c67c8f7523f6a94d61a82d
Gitweb:     http://git.kernel.org/tip/f67d395c6e3895c3c8c67c8f7523f6a94d61a82d
Author:     Taeung Song <[email protected]>
AuthorDate: Fri, 28 Jul 2017 12:04:32 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 28 Jul 2017 12:53:08 -0300

perf annotate TUI: Fix column header when toggling period/percent

We have the 't' hotkey to toggle showing either the total period or the percentage of samples for a given line, but we forgot to toggle as well the column header, always showing "Percent", even when showing the period, fix it.

Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
[ Extracted from a larger patch, s/Event count/Period/g ]
---
 tools/perf/ui/browsers/annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/ui/browsers/annotate.c +1 -1
index 0f4bcc0..46f297a 100644
@@ -166,7 +166,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
 		if (!show_title)
 			ui_browser__write_nstring(browser, " ", pcnt_width);
 		else
-			ui_browser__printf(browser, "%*s", 7, "Percent");
+			ui_browser__printf(browser, "%*s", 7, annotate_browser__opts.show_total_period ? "Period" : "Percent");
 	}
 	if (ab->have_cycles) {
 		if (dl->ipc)