Commit 2f335a02 authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Ingo Molnar
Browse files

perf top: Fix zero or negative refresh delay

If perf top is executed with a zero value for the refresh rate,
we get a division by zero exception while computing samples_per_sec.

Also a zero refresh rate is not possible, neither do we want to
accept negative values.

[ Impact: fix division by zero in perf top ]

Cc: Peter Zijlstra <>
Cc: Mike Galbraith <>
Cc: Paul Mackerras <>
Cc: Corey Ashford <>
Cc: Marcelo Tosatti <>
Cc: Arnaldo Carvalho de Melo <>
Cc: Frederic Weisbecker <>
LKML-Reference: <>
Signed-off-by: default avatarIngo Molnar <>
parent 1dba15e7
......@@ -693,6 +693,9 @@ int cmd_top(int argc, const char **argv, const char *prefix)
event_id[0] = 0;
if (delay_secs < 1)
delay_secs = 1;
for (counter = 0; counter < nr_counters; counter++) {
if (event_count[counter])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment