diff options
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; |