diff options
Diffstat (limited to 'kernel/trace/ring_buffer_benchmark.c')
-rw-r--r-- | kernel/trace/ring_buffer_benchmark.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/trace/ring_buffer_benchmark.c b/kernel/trace/ring_buffer_benchmark.c index 7d3aef93c49f..8d68e149a8b3 100644 --- a/kernel/trace/ring_buffer_benchmark.c +++ b/kernel/trace/ring_buffer_benchmark.c | |||
@@ -294,6 +294,12 @@ static void ring_buffer_producer(void) | |||
294 | 294 | ||
295 | pr_info("Total iterations per millisec: %ld\n", hit + missed); | 295 | pr_info("Total iterations per millisec: %ld\n", hit + missed); |
296 | 296 | ||
297 | /* it is possible that hit + missed will overflow and be zero */ | ||
298 | if (!(hit + missed)) { | ||
299 | pr_info("hit + missed overflowed and totalled zero!\n"); | ||
300 | hit--; /* make it non zero */ | ||
301 | } | ||
302 | |||
297 | /* Caculate the average time in nanosecs */ | 303 | /* Caculate the average time in nanosecs */ |
298 | avg = NSEC_PER_MSEC / (hit + missed); | 304 | avg = NSEC_PER_MSEC / (hit + missed); |
299 | pr_info("%ld ns per entry\n", avg); | 305 | pr_info("%ld ns per entry\n", avg); |