diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-10-04 21:49:40 +0900 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-04 13:31:30 -0300 |
commit | b5ff71c3bab10a7a4b321b5de072ac5bd73ef9a4 (patch) | |
tree | 592b9041b8ad7257272f6e902bddcb747ce77410 /tools/perf/ui/hist.c | |
parent | 1d77822ea6245e89149872405a3844e0778a004a (diff) | |
download | linux-b5ff71c3bab10a7a4b321b5de072ac5bd73ef9a4.tar.bz2 |
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) static int hpp__color_overhead(struct perf_hpp *hpp, struct hist_entry *he) { - double percent = 100.0 * he->period / hpp->total_period; + struct hists *hists = he->hists; + double percent = 100.0 * he->period / hists->stats.total_period; return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent); } static int hpp__entry_overhead(struct perf_hpp *hpp, struct hist_entry *he) { - double percent = 100.0 * he->period / hpp->total_period; + struct hists *hists = he->hists; + double percent = 100.0 * he->period / hists->stats.total_period; const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%"; return scnprintf(hpp->buf, hpp->size, fmt, percent); @@ -45,13 +47,16 @@ static int hpp__width_overhead_sys(struct perf_hpp *hpp __maybe_unused) static int hpp__color_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) { - double percent = 100.0 * he->period_sys / hpp->total_period; + struct hists *hists = he->hists; + double percent = 100.0 * he->period_sys / hists->stats.total_period; + return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent); } static int hpp__entry_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) { - double percent = 100.0 * he->period_sys / hpp->total_period; + struct hists *hists = he->hists; + double percent = 100.0 * he->period_sys / hists->stats.total_period; const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%"; return scnprintf(hpp->buf, hpp->size, fmt, percent); @@ -71,13 +76,16 @@ static int hpp__width_overhead_us(struct perf_hpp *hpp __maybe_unused) static int hpp__color_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) { - double percent = 100.0 * he->period_us / hpp->total_period; + struct hists *hists = he->hists; + double percent = 100.0 * he->period_us / hists->stats.total_period; + return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent); } static int hpp__entry_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) { - double percent = 100.0 * he->period_us / hpp->total_period; + struct hists *hists = he->hists; + double percent = 100.0 * he->period_us / hists->stats.total_period; const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%"; 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) static int hpp__color_overhead_guest_sys(struct perf_hpp *hpp, struct hist_entry *he) { - double percent = 100.0 * he->period_guest_sys / hpp->total_period; + struct hists *hists = he->hists; + double percent = 100.0 * he->period_guest_sys / hists->stats.total_period; + return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent); } static int hpp__entry_overhead_guest_sys(struct perf_hpp *hpp, struct hist_entry *he) { - double percent = 100.0 * he->period_guest_sys / hpp->total_period; + struct hists *hists = he->hists; + double percent = 100.0 * he->period_guest_sys / hists->stats.total_period; const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% "; 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) static int hpp__color_overhead_guest_us(struct perf_hpp *hpp, struct hist_entry *he) { - double percent = 100.0 * he->period_guest_us / hpp->total_period; + struct hists *hists = he->hists; + double percent = 100.0 * he->period_guest_us / hists->stats.total_period; + return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent); } static int hpp__entry_overhead_guest_us(struct perf_hpp *hpp, struct hist_entry *he) { - double percent = 100.0 * he->period_guest_us / hpp->total_period; + struct hists *hists = he->hists; + double percent = 100.0 * he->period_guest_us / hists->stats.total_period; const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% "; 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) { struct hist_entry *pair = he->pair; struct hists *pair_hists = pair ? pair->hists : NULL; + struct hists *hists = he->hists; u64 old_total, new_total; double old_percent = 0, new_percent = 0; double diff; @@ -240,7 +255,7 @@ static int hpp__entry_delta(struct perf_hpp *hpp, struct hist_entry *he) if (old_total > 0 && pair) old_percent = 100.0 * pair->period / old_total; - new_total = hpp->total_period; + new_total = hists->stats.total_period; if (new_total > 0) new_percent = 100.0 * he->period / new_total; |