diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-10-04 08:49:40 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-04 12:31:30 -0400 |
commit | b5ff71c3bab10a7a4b321b5de072ac5bd73ef9a4 (patch) | |
tree | 592b9041b8ad7257272f6e902bddcb747ce77410 /tools/perf/ui/hist.c | |
parent | 1d77822ea6245e89149872405a3844e0778a004a (diff) |
perf diff: Removing the total_period argument from output code
The total_period is available in struct hists data via the 'struct
hist_entry::hists' pointer. There's no need to carry it through the
output code path.
Removing 'struct perf_hpp::total_period' pointer, because it's no longer
needed.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1349354994-17853-7-git-send-email-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/hist.c')
-rw-r--r-- | tools/perf/ui/hist.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index e8853f7780a3..7f043394bef1 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -18,14 +18,16 @@ static int hpp__width_overhead(struct perf_hpp *hpp __maybe_unused) | |||
18 | 18 | ||
19 | static int hpp__color_overhead(struct perf_hpp *hpp, struct hist_entry *he) | 19 | static int hpp__color_overhead(struct perf_hpp *hpp, struct hist_entry *he) |
20 | { | 20 | { |
21 | double percent = 100.0 * he->period / hpp->total_period; | 21 | struct hists *hists = he->hists; |
22 | double percent = 100.0 * he->period / hists->stats.total_period; | ||
22 | 23 | ||
23 | return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent); | 24 | return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent); |
24 | } | 25 | } |
25 | 26 | ||
26 | static int hpp__entry_overhead(struct perf_hpp *hpp, struct hist_entry *he) | 27 | static int hpp__entry_overhead(struct perf_hpp *hpp, struct hist_entry *he) |
27 | { | 28 | { |
28 | double percent = 100.0 * he->period / hpp->total_period; | 29 | struct hists *hists = he->hists; |
30 | double percent = 100.0 * he->period / hists->stats.total_period; | ||
29 | const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%"; | 31 | const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%"; |
30 | 32 | ||
31 | return scnprintf(hpp->buf, hpp->size, fmt, percent); | 33 | return scnprintf(hpp->buf, hpp->size, fmt, percent); |
@@ -45,13 +47,16 @@ static int hpp__width_overhead_sys(struct perf_hpp *hpp __maybe_unused) | |||
45 | 47 | ||
46 | static int hpp__color_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) | 48 | static int hpp__color_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) |
47 | { | 49 | { |
48 | double percent = 100.0 * he->period_sys / hpp->total_period; | 50 | struct hists *hists = he->hists; |
51 | double percent = 100.0 * he->period_sys / hists->stats.total_period; | ||
52 | |||
49 | return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent); | 53 | return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent); |
50 | } | 54 | } |
51 | 55 | ||
52 | static int hpp__entry_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) | 56 | static int hpp__entry_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) |
53 | { | 57 | { |
54 | double percent = 100.0 * he->period_sys / hpp->total_period; | 58 | struct hists *hists = he->hists; |
59 | double percent = 100.0 * he->period_sys / hists->stats.total_period; | ||
55 | const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%"; | 60 | const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%"; |
56 | 61 | ||
57 | return scnprintf(hpp->buf, hpp->size, fmt, percent); | 62 | return scnprintf(hpp->buf, hpp->size, fmt, percent); |
@@ -71,13 +76,16 @@ static int hpp__width_overhead_us(struct perf_hpp *hpp __maybe_unused) | |||
71 | 76 | ||
72 | static int hpp__color_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) | 77 | static int hpp__color_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) |
73 | { | 78 | { |
74 | double percent = 100.0 * he->period_us / hpp->total_period; | 79 | struct hists *hists = he->hists; |
80 | double percent = 100.0 * he->period_us / hists->stats.total_period; | ||
81 | |||
75 | return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent); | 82 | return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent); |
76 | } | 83 | } |
77 | 84 | ||
78 | static int hpp__entry_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) | 85 | static int hpp__entry_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) |
79 | { | 86 | { |
80 | double percent = 100.0 * he->period_us / hpp->total_period; | 87 | struct hists *hists = he->hists; |
88 | double percent = 100.0 * he->period_us / hists->stats.total_period; | ||
81 | const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%"; | 89 | const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%"; |
82 | 90 | ||
83 | return scnprintf(hpp->buf, hpp->size, fmt, percent); | 91 | return scnprintf(hpp->buf, hpp->size, fmt, percent); |
@@ -96,14 +104,17 @@ static int hpp__width_overhead_guest_sys(struct perf_hpp *hpp __maybe_unused) | |||
96 | static int hpp__color_overhead_guest_sys(struct perf_hpp *hpp, | 104 | static int hpp__color_overhead_guest_sys(struct perf_hpp *hpp, |
97 | struct hist_entry *he) | 105 | struct hist_entry *he) |
98 | { | 106 | { |
99 | double percent = 100.0 * he->period_guest_sys / hpp->total_period; | 107 | struct hists *hists = he->hists; |
108 | double percent = 100.0 * he->period_guest_sys / hists->stats.total_period; | ||
109 | |||
100 | return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent); | 110 | return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent); |
101 | } | 111 | } |
102 | 112 | ||
103 | static int hpp__entry_overhead_guest_sys(struct perf_hpp *hpp, | 113 | static int hpp__entry_overhead_guest_sys(struct perf_hpp *hpp, |
104 | struct hist_entry *he) | 114 | struct hist_entry *he) |
105 | { | 115 | { |
106 | double percent = 100.0 * he->period_guest_sys / hpp->total_period; | 116 | struct hists *hists = he->hists; |
117 | double percent = 100.0 * he->period_guest_sys / hists->stats.total_period; | ||
107 | const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% "; | 118 | const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% "; |
108 | 119 | ||
109 | return scnprintf(hpp->buf, hpp->size, fmt, percent); | 120 | return scnprintf(hpp->buf, hpp->size, fmt, percent); |
@@ -122,14 +133,17 @@ static int hpp__width_overhead_guest_us(struct perf_hpp *hpp __maybe_unused) | |||
122 | static int hpp__color_overhead_guest_us(struct perf_hpp *hpp, | 133 | static int hpp__color_overhead_guest_us(struct perf_hpp *hpp, |
123 | struct hist_entry *he) | 134 | struct hist_entry *he) |
124 | { | 135 | { |
125 | double percent = 100.0 * he->period_guest_us / hpp->total_period; | 136 | struct hists *hists = he->hists; |
137 | double percent = 100.0 * he->period_guest_us / hists->stats.total_period; | ||
138 | |||
126 | return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent); | 139 | return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent); |
127 | } | 140 | } |
128 | 141 | ||
129 | static int hpp__entry_overhead_guest_us(struct perf_hpp *hpp, | 142 | static int hpp__entry_overhead_guest_us(struct perf_hpp *hpp, |
130 | struct hist_entry *he) | 143 | struct hist_entry *he) |
131 | { | 144 | { |
132 | double percent = 100.0 * he->period_guest_us / hpp->total_period; | 145 | struct hists *hists = he->hists; |
146 | double percent = 100.0 * he->period_guest_us / hists->stats.total_period; | ||
133 | const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% "; | 147 | const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% "; |
134 | 148 | ||
135 | return scnprintf(hpp->buf, hpp->size, fmt, percent); | 149 | return scnprintf(hpp->buf, hpp->size, fmt, percent); |
@@ -230,6 +244,7 @@ static int hpp__entry_delta(struct perf_hpp *hpp, struct hist_entry *he) | |||
230 | { | 244 | { |
231 | struct hist_entry *pair = he->pair; | 245 | struct hist_entry *pair = he->pair; |
232 | struct hists *pair_hists = pair ? pair->hists : NULL; | 246 | struct hists *pair_hists = pair ? pair->hists : NULL; |
247 | struct hists *hists = he->hists; | ||
233 | u64 old_total, new_total; | 248 | u64 old_total, new_total; |
234 | double old_percent = 0, new_percent = 0; | 249 | double old_percent = 0, new_percent = 0; |
235 | double diff; | 250 | double diff; |
@@ -240,7 +255,7 @@ static int hpp__entry_delta(struct perf_hpp *hpp, struct hist_entry *he) | |||
240 | if (old_total > 0 && pair) | 255 | if (old_total > 0 && pair) |
241 | old_percent = 100.0 * pair->period / old_total; | 256 | old_percent = 100.0 * pair->period / old_total; |
242 | 257 | ||
243 | new_total = hpp->total_period; | 258 | new_total = hists->stats.total_period; |
244 | if (new_total > 0) | 259 | if (new_total > 0) |
245 | new_percent = 100.0 * he->period / new_total; | 260 | new_percent = 100.0 * he->period / new_total; |
246 | 261 | ||