File perf-annotate-browser-display-titles-in-left-frame.patch of Package perf
114
1
From: Jin Yao <yao.jin@linux.intel.com>
2
Date: Thu, 4 May 2017 22:58:15 +0800
3
Subject: perf annotate browser: Display titles in left frame
4
MIME-Version: 1.0
5
Content-Type: text/plain; charset=UTF-8
6
Content-Transfer-Encoding: 8bit
7
Git-commit: ec27ae1892f7f8119ce82535ffcc2889ea3bb3d8
8
Patch-mainline: v4.13-rc1
9
References: bsc#1070010 (git-fixes - dependent)
10
Signed-off-By: Tony Jones <tonyj@suse.de>
11
12
The annotate browser is divided into 2 frames. Left frame contains 3
13
columns (some platforms only have one column).
14
15
For example:
16
17
│26 int compute_flag()
18
│27 {
19
22.80 1.20 │ sub $0x8,%rsp
20
│25 int i;
21
│
22
│27 i = rand() % 2;
23
22.78 1.20 1 │ → callq rand@plt
24
25
While it's hard for user to understand what the data is.
26
27
This patch adds the titles "Percent", "IPC" and "Cycle" on columns.
28
29
Percent IPC Cycle │
30
│25 __attribute__((noinline))
31
│26 int compute_flag()
32
│27 {
33
22.80 1.20 │ sub $0x8,%rsp
34
│25 int i;
35
│
36
│27 i = rand() % 2;
37
22.78 1.20 1 │ → callq rand@plt
38
39
The titles are displayed at row 0 of annotate browser if row 0 doesn't
40
have values of percent, ipc and cycle.
41
42
Signed-off-by: Yao Jin <yao.jin@linux.intel.com>
43
Acked-by: Milian Wolff <milian.wolff@kdab.com>
44
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
45
Cc: Andi Kleen <ak@linux.intel.com>
46
Cc: Jiri Olsa <jolsa@kernel.org>
47
Cc: Kan Liang <kan.liang@intel.com>
48
Cc: Peter Zijlstra <peterz@infradead.org>
49
Cc: Yao Jin <yao.jin@linux.intel.com>
50
Link: http://lkml.kernel.org/r/1493909895-9668-3-git-send-email-yao.jin@linux.intel.com
51
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
52
---
53
tools/perf/ui/browsers/annotate.c | 24 +++++++++++++++++++++---
54
1 file changed, 21 insertions(+), 3 deletions(-)
55
56
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
57
index 52c1e8d672b5..7a03389b7a03 100644
58
--- a/tools/perf/ui/browsers/annotate.c
59
+++ b/tools/perf/ui/browsers/annotate.c
60
61
int i, pcnt_width = annotate_browser__pcnt_width(ab);
62
double percent_max = 0.0;
63
char bf[256];
64
+ bool show_title = false;
65
66
for (i = 0; i < ab->nr_events; i++) {
67
if (bdl->samples[i].percent > percent_max)
68
percent_max = bdl->samples[i].percent;
69
}
70
71
+ if ((row == 0) && (dl->offset == -1 || percent_max == 0.0)) {
72
+ if (ab->have_cycles) {
73
+ if (dl->ipc == 0.0 && dl->cycles == 0)
74
+ show_title = true;
75
+ } else
76
+ show_title = true;
77
+ }
78
+
79
if (dl->offset != -1 && percent_max != 0.0) {
80
for (i = 0; i < ab->nr_events; i++) {
81
ui_browser__set_percent_color(browser,
82
83
}
84
} else {
85
ui_browser__set_percent_color(browser, 0, current_entry);
86
- ui_browser__write_nstring(browser, " ", 7 * ab->nr_events);
87
+
88
+ if (!show_title)
89
+ ui_browser__write_nstring(browser, " ", 7 * ab->nr_events);
90
+ else
91
+ ui_browser__printf(browser, "%*s", 7, "Percent");
92
}
93
if (ab->have_cycles) {
94
if (dl->ipc)
95
ui_browser__printf(browser, "%*.2f ", IPC_WIDTH - 1, dl->ipc);
96
- else
97
+ else if (!show_title)
98
ui_browser__write_nstring(browser, " ", IPC_WIDTH);
99
+ else
100
+ ui_browser__printf(browser, "%*s ", IPC_WIDTH - 1, "IPC");
101
+
102
if (dl->cycles)
103
ui_browser__printf(browser, "%*" PRIu64 " ",
104
CYCLES_WIDTH - 1, dl->cycles);
105
- else
106
+ else if (!show_title)
107
ui_browser__write_nstring(browser, " ", CYCLES_WIDTH);
108
+ else
109
+ ui_browser__printf(browser, "%*s ", CYCLES_WIDTH - 1, "Cycle");
110
}
111
112
SLsmg_write_char(' ');
113
114