aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/hist.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/ui/hist.c')
-rw-r--r--tools/perf/ui/hist.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 532a60177c32..6b0138e5f332 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -228,16 +228,17 @@ static int hpp__width_delta(struct perf_hpp *hpp __maybe_unused)
228 228
229static int hpp__entry_delta(struct perf_hpp *hpp, struct hist_entry *he) 229static int hpp__entry_delta(struct perf_hpp *hpp, struct hist_entry *he)
230{ 230{
231 struct hists *pair_hists = hpp->ptr; 231 struct hist_entry *pair = he->pair;
232 struct hists *pair_hists = pair ? pair->hists : NULL;
232 u64 old_total, new_total; 233 u64 old_total, new_total;
233 double old_percent = 0, new_percent = 0; 234 double old_percent = 0, new_percent = 0;
234 double diff; 235 double diff;
235 const char *fmt = symbol_conf.field_sep ? "%s" : "%7.7s"; 236 const char *fmt = symbol_conf.field_sep ? "%s" : "%7.7s";
236 char buf[32] = " "; 237 char buf[32] = " ";
237 238
238 old_total = pair_hists->stats.total_period; 239 old_total = pair_hists ? pair_hists->stats.total_period : 0;
239 if (old_total > 0 && he->pair) 240 if (old_total > 0 && pair)
240 old_percent = 100.0 * he->pair->period / old_total; 241 old_percent = 100.0 * pair->period / old_total;
241 242
242 new_total = hpp->total_period; 243 new_total = hpp->total_period;
243 if (new_total > 0) 244 if (new_total > 0)