aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/hist.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-10-04 08:49:41 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-04 12:34:22 -0400
commitb24c28f794e1821c1bba3ef7e9e948ab77ee00ac (patch)
treeadeffc7cf0b7254f68e6a64640bf06cc677bcd4e /tools/perf/ui/hist.c
parentb5ff71c3bab10a7a4b321b5de072ac5bd73ef9a4 (diff)
perf hists: Introduce struct he_stat
The struct he_stat is for separating out statistics data of a hist entry. It is required for later changes. It's just a mechanical change and should have no functional differences. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Arun Sharma <asharma@fb.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1349354994-17853-8-git-send-email-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.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 7f043394bef1..f5a1e4f65263 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -19,7 +19,7 @@ static int hpp__width_overhead(struct perf_hpp *hpp __maybe_unused)
19static int hpp__color_overhead(struct perf_hpp *hpp, struct hist_entry *he) 19static int hpp__color_overhead(struct perf_hpp *hpp, struct hist_entry *he)
20{ 20{
21 struct hists *hists = he->hists; 21 struct hists *hists = he->hists;
22 double percent = 100.0 * he->period / hists->stats.total_period; 22 double percent = 100.0 * he->stat.period / hists->stats.total_period;
23 23
24 return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent); 24 return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent);
25} 25}
@@ -27,7 +27,7 @@ static int hpp__color_overhead(struct perf_hpp *hpp, struct hist_entry *he)
27static int hpp__entry_overhead(struct perf_hpp *hpp, struct hist_entry *he) 27static int hpp__entry_overhead(struct perf_hpp *hpp, struct hist_entry *he)
28{ 28{
29 struct hists *hists = he->hists; 29 struct hists *hists = he->hists;
30 double percent = 100.0 * he->period / hists->stats.total_period; 30 double percent = 100.0 * he->stat.period / hists->stats.total_period;
31 const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%"; 31 const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%";
32 32
33 return scnprintf(hpp->buf, hpp->size, fmt, percent); 33 return scnprintf(hpp->buf, hpp->size, fmt, percent);
@@ -48,7 +48,7 @@ static int hpp__width_overhead_sys(struct perf_hpp *hpp __maybe_unused)
48static int hpp__color_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) 48static int hpp__color_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he)
49{ 49{
50 struct hists *hists = he->hists; 50 struct hists *hists = he->hists;
51 double percent = 100.0 * he->period_sys / hists->stats.total_period; 51 double percent = 100.0 * he->stat.period_sys / hists->stats.total_period;
52 52
53 return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent); 53 return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent);
54} 54}
@@ -56,7 +56,7 @@ static int hpp__color_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he)
56static int hpp__entry_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) 56static int hpp__entry_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he)
57{ 57{
58 struct hists *hists = he->hists; 58 struct hists *hists = he->hists;
59 double percent = 100.0 * he->period_sys / hists->stats.total_period; 59 double percent = 100.0 * he->stat.period_sys / hists->stats.total_period;
60 const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%"; 60 const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%";
61 61
62 return scnprintf(hpp->buf, hpp->size, fmt, percent); 62 return scnprintf(hpp->buf, hpp->size, fmt, percent);
@@ -77,7 +77,7 @@ static int hpp__width_overhead_us(struct perf_hpp *hpp __maybe_unused)
77static int hpp__color_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) 77static int hpp__color_overhead_us(struct perf_hpp *hpp, struct hist_entry *he)
78{ 78{
79 struct hists *hists = he->hists; 79 struct hists *hists = he->hists;
80 double percent = 100.0 * he->period_us / hists->stats.total_period; 80 double percent = 100.0 * he->stat.period_us / hists->stats.total_period;
81 81
82 return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent); 82 return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent);
83} 83}
@@ -85,7 +85,7 @@ static int hpp__color_overhead_us(struct perf_hpp *hpp, struct hist_entry *he)
85static int hpp__entry_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) 85static int hpp__entry_overhead_us(struct perf_hpp *hpp, struct hist_entry *he)
86{ 86{
87 struct hists *hists = he->hists; 87 struct hists *hists = he->hists;
88 double percent = 100.0 * he->period_us / hists->stats.total_period; 88 double percent = 100.0 * he->stat.period_us / hists->stats.total_period;
89 const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%"; 89 const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%";
90 90
91 return scnprintf(hpp->buf, hpp->size, fmt, percent); 91 return scnprintf(hpp->buf, hpp->size, fmt, percent);
@@ -105,7 +105,7 @@ static int hpp__color_overhead_guest_sys(struct perf_hpp *hpp,
105 struct hist_entry *he) 105 struct hist_entry *he)
106{ 106{
107 struct hists *hists = he->hists; 107 struct hists *hists = he->hists;
108 double percent = 100.0 * he->period_guest_sys / hists->stats.total_period; 108 double percent = 100.0 * he->stat.period_guest_sys / hists->stats.total_period;
109 109
110 return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent); 110 return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent);
111} 111}
@@ -114,7 +114,7 @@ static int hpp__entry_overhead_guest_sys(struct perf_hpp *hpp,
114 struct hist_entry *he) 114 struct hist_entry *he)
115{ 115{
116 struct hists *hists = he->hists; 116 struct hists *hists = he->hists;
117 double percent = 100.0 * he->period_guest_sys / hists->stats.total_period; 117 double percent = 100.0 * he->stat.period_guest_sys / hists->stats.total_period;
118 const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% "; 118 const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% ";
119 119
120 return scnprintf(hpp->buf, hpp->size, fmt, percent); 120 return scnprintf(hpp->buf, hpp->size, fmt, percent);
@@ -134,7 +134,7 @@ static int hpp__color_overhead_guest_us(struct perf_hpp *hpp,
134 struct hist_entry *he) 134 struct hist_entry *he)
135{ 135{
136 struct hists *hists = he->hists; 136 struct hists *hists = he->hists;
137 double percent = 100.0 * he->period_guest_us / hists->stats.total_period; 137 double percent = 100.0 * he->stat.period_guest_us / hists->stats.total_period;
138 138
139 return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent); 139 return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent);
140} 140}
@@ -143,7 +143,7 @@ static int hpp__entry_overhead_guest_us(struct perf_hpp *hpp,
143 struct hist_entry *he) 143 struct hist_entry *he)
144{ 144{
145 struct hists *hists = he->hists; 145 struct hists *hists = he->hists;
146 double percent = 100.0 * he->period_guest_us / hists->stats.total_period; 146 double percent = 100.0 * he->stat.period_guest_us / hists->stats.total_period;
147 const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% "; 147 const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% ";
148 148
149 return scnprintf(hpp->buf, hpp->size, fmt, percent); 149 return scnprintf(hpp->buf, hpp->size, fmt, percent);
@@ -167,7 +167,7 @@ static double baseline_percent(struct hist_entry *he)
167 167
168 if (pair) { 168 if (pair) {
169 u64 total_period = pair_hists->stats.total_period; 169 u64 total_period = pair_hists->stats.total_period;
170 u64 base_period = pair->period; 170 u64 base_period = pair->stat.period;
171 171
172 percent = 100.0 * base_period / total_period; 172 percent = 100.0 * base_period / total_period;
173 } 173 }
@@ -206,7 +206,7 @@ static int hpp__entry_samples(struct perf_hpp *hpp, struct hist_entry *he)
206{ 206{
207 const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%11" PRIu64; 207 const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%11" PRIu64;
208 208
209 return scnprintf(hpp->buf, hpp->size, fmt, he->nr_events); 209 return scnprintf(hpp->buf, hpp->size, fmt, he->stat.nr_events);
210} 210}
211 211
212static int hpp__header_period(struct perf_hpp *hpp) 212static int hpp__header_period(struct perf_hpp *hpp)
@@ -225,7 +225,7 @@ static int hpp__entry_period(struct perf_hpp *hpp, struct hist_entry *he)
225{ 225{
226 const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%12" PRIu64; 226 const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%12" PRIu64;
227 227
228 return scnprintf(hpp->buf, hpp->size, fmt, he->period); 228 return scnprintf(hpp->buf, hpp->size, fmt, he->stat.period);
229} 229}
230 230
231static int hpp__header_delta(struct perf_hpp *hpp) 231static int hpp__header_delta(struct perf_hpp *hpp)
@@ -253,11 +253,11 @@ static int hpp__entry_delta(struct perf_hpp *hpp, struct hist_entry *he)
253 253
254 old_total = pair_hists ? pair_hists->stats.total_period : 0; 254 old_total = pair_hists ? pair_hists->stats.total_period : 0;
255 if (old_total > 0 && pair) 255 if (old_total > 0 && pair)
256 old_percent = 100.0 * pair->period / old_total; 256 old_percent = 100.0 * pair->stat.period / old_total;
257 257
258 new_total = hists->stats.total_period; 258 new_total = hists->stats.total_period;
259 if (new_total > 0) 259 if (new_total > 0)
260 new_percent = 100.0 * he->period / new_total; 260 new_percent = 100.0 * he->stat.period / new_total;
261 261
262 diff = new_percent - old_percent; 262 diff = new_percent - old_percent;
263 if (fabs(diff) >= 0.01) 263 if (fabs(diff) >= 0.01)