Skip to contentSkip to conversation

perf ui progress: Fix divide by zero

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Dec 5, 2011 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  18b552350515188a732db6ccdb81e9cefb8b58c9
Gitweb:     http://git.kernel.org/tip/18b552350515188a732db6ccdb81e9cefb8b58c9
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Fri, 11 Nov 2011 22:08:07 -0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 28 Nov 2011 10:36:57 -0200

perf ui progress: Fix divide by zero

Happens in a perf.data file where one of the events had no samples.

Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/ui/progress.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
tools/perf/util/ui/progress.c +3 -0
index 295e366..13aa64e 100644
@@ -14,6 +14,9 @@ void ui_progress__update(u64 curr, u64 total, const char *title)
 	if (use_browser <= 0)
 		return;
 
+	if (total == 0)
+		return;
+
 	ui__refresh_dimensions(true);
 	pthread_mutex_lock(&ui__lock);
 	y = SLtt_Screen_Rows / 2 - 2;