aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-10-04 08:49:40 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-04 12:31:30 -0400
commitb5ff71c3bab10a7a4b321b5de072ac5bd73ef9a4 (patch)
tree592b9041b8ad7257272f6e902bddcb747ce77410 /tools/perf
parent1d77822ea6245e89149872405a3844e0778a004a (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')
-rw-r--r--tools/perf/ui/browsers/hists.c4
-rw-r--r--tools/perf/ui/gtk/browser.c4
-rw-r--r--tools/perf/ui/hist.c37
-rw-r--r--tools/perf/ui/stdio/hist.c15
-rw-r--r--tools/perf/util/hist.h1
5 files changed, 35 insertions, 26 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index bbd11c2f69db..d359795454d0 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -569,7 +569,8 @@ static int hist_browser__show_callchain(struct hist_browser *browser,
569static int hist_browser__hpp_color_ ## _name(struct perf_hpp *hpp, \ 569static int hist_browser__hpp_color_ ## _name(struct perf_hpp *hpp, \
570 struct hist_entry *he) \ 570 struct hist_entry *he) \
571{ \ 571{ \
572 double percent = 100.0 * he->_field / hpp->total_period; \ 572 struct hists *hists = he->hists; \
573 double percent = 100.0 * he->_field / hists->stats.total_period;\
573 *(double *)hpp->ptr = percent; \ 574 *(double *)hpp->ptr = percent; \
574 return scnprintf(hpp->buf, hpp->size, "%6.2f%%", percent); \ 575 return scnprintf(hpp->buf, hpp->size, "%6.2f%%", percent); \
575} 576}
@@ -624,7 +625,6 @@ static int hist_browser__show_entry(struct hist_browser *browser,
624 struct perf_hpp hpp = { 625 struct perf_hpp hpp = {
625 .buf = s, 626 .buf = s,
626 .size = sizeof(s), 627 .size = sizeof(s),
627 .total_period = browser->hists->stats.total_period,
628 }; 628 };
629 629
630 ui_browser__gotorc(&browser->b, row, 0); 630 ui_browser__gotorc(&browser->b, row, 0);
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c
index 2bc08f6af714..3cbb1d622ed2 100644
--- a/tools/perf/ui/gtk/browser.c
+++ b/tools/perf/ui/gtk/browser.c
@@ -49,7 +49,8 @@ static const char *perf_gtk__get_percent_color(double percent)
49static int perf_gtk__hpp_color_ ## _name(struct perf_hpp *hpp, \ 49static int perf_gtk__hpp_color_ ## _name(struct perf_hpp *hpp, \
50 struct hist_entry *he) \ 50 struct hist_entry *he) \
51{ \ 51{ \
52 double percent = 100.0 * he->_field / hpp->total_period; \ 52 struct hists *hists = he->hists; \
53 double percent = 100.0 * he->_field / hists->stats.total_period; \
53 const char *markup; \ 54 const char *markup; \
54 int ret = 0; \ 55 int ret = 0; \
55 \ 56 \
@@ -102,7 +103,6 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists)
102 struct perf_hpp hpp = { 103 struct perf_hpp hpp = {
103 .buf = s, 104 .buf = s,
104 .size = sizeof(s), 105 .size = sizeof(s),
105 .total_period = hists->stats.total_period,
106 }; 106 };
107 107
108 nr_cols = 0; 108 nr_cols = 0;
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
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 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
26static 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)
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
46static 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)
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
52static 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)
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
72static 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)
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
78static 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)
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)
96static int hpp__color_overhead_guest_sys(struct perf_hpp *hpp, 104static 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
103static int hpp__entry_overhead_guest_sys(struct perf_hpp *hpp, 113static 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)
122static int hpp__color_overhead_guest_us(struct perf_hpp *hpp, 133static 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
129static int hpp__entry_overhead_guest_us(struct perf_hpp *hpp, 142static 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;