aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui
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
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')
-rw-r--r--tools/perf/ui/browsers/hists.c8
-rw-r--r--tools/perf/ui/gtk/browser.c2
-rw-r--r--tools/perf/ui/hist.c30
-rw-r--r--tools/perf/ui/stdio/hist.c2
4 files changed, 21 insertions, 21 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index d359795454d0..0568536ecf67 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -570,7 +570,7 @@ static int hist_browser__hpp_color_ ## _name(struct perf_hpp *hpp, \
570 struct hist_entry *he) \ 570 struct hist_entry *he) \
571{ \ 571{ \
572 struct hists *hists = he->hists; \ 572 struct hists *hists = he->hists; \
573 double percent = 100.0 * he->_field / hists->stats.total_period;\ 573 double percent = 100.0 * he->stat._field / hists->stats.total_period; \
574 *(double *)hpp->ptr = percent; \ 574 *(double *)hpp->ptr = percent; \
575 return scnprintf(hpp->buf, hpp->size, "%6.2f%%", percent); \ 575 return scnprintf(hpp->buf, hpp->size, "%6.2f%%", percent); \
576} 576}
@@ -982,7 +982,7 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser,
982 folded_sign = hist_entry__folded(he); 982 folded_sign = hist_entry__folded(he);
983 983
984 hist_entry__sort_snprintf(he, s, sizeof(s), browser->hists); 984 hist_entry__sort_snprintf(he, s, sizeof(s), browser->hists);
985 percent = (he->period * 100.0) / browser->hists->stats.total_period; 985 percent = (he->stat.period * 100.0) / browser->hists->stats.total_period;
986 986
987 if (symbol_conf.use_callchain) 987 if (symbol_conf.use_callchain)
988 printed += fprintf(fp, "%c ", folded_sign); 988 printed += fprintf(fp, "%c ", folded_sign);
@@ -990,10 +990,10 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser,
990 printed += fprintf(fp, " %5.2f%%", percent); 990 printed += fprintf(fp, " %5.2f%%", percent);
991 991
992 if (symbol_conf.show_nr_samples) 992 if (symbol_conf.show_nr_samples)
993 printed += fprintf(fp, " %11u", he->nr_events); 993 printed += fprintf(fp, " %11u", he->stat.nr_events);
994 994
995 if (symbol_conf.show_total_period) 995 if (symbol_conf.show_total_period)
996 printed += fprintf(fp, " %12" PRIu64, he->period); 996 printed += fprintf(fp, " %12" PRIu64, he->stat.period);
997 997
998 printed += fprintf(fp, "%s\n", rtrim(s)); 998 printed += fprintf(fp, "%s\n", rtrim(s));
999 999
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c
index 3cbb1d622ed2..4125c6284114 100644
--- a/tools/perf/ui/gtk/browser.c
+++ b/tools/perf/ui/gtk/browser.c
@@ -50,7 +50,7 @@ static int perf_gtk__hpp_color_ ## _name(struct perf_hpp *hpp, \
50 struct hist_entry *he) \ 50 struct hist_entry *he) \
51{ \ 51{ \
52 struct hists *hists = he->hists; \ 52 struct hists *hists = he->hists; \
53 double percent = 100.0 * he->_field / hists->stats.total_period; \ 53 double percent = 100.0 * he->stat._field / hists->stats.total_period; \
54 const char *markup; \ 54 const char *markup; \
55 int ret = 0; \ 55 int ret = 0; \
56 \ 56 \
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)
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 850c6d293f46..fbd4e32d0743 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -271,7 +271,7 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he,
271{ 271{
272 switch (callchain_param.mode) { 272 switch (callchain_param.mode) {
273 case CHAIN_GRAPH_REL: 273 case CHAIN_GRAPH_REL:
274 return callchain__fprintf_graph(fp, &he->sorted_chain, he->period, 274 return callchain__fprintf_graph(fp, &he->sorted_chain, he->stat.period,
275 left_margin); 275 left_margin);
276 break; 276 break;
277 case CHAIN_GRAPH_ABS: 277 case CHAIN_GRAPH_ABS: