From 08dd0e90617b4af0383935b4d211a60d823b9c08 Mon Sep 17 00:00:00 2001 From: Michel Machado Date: Mon, 16 Nov 2015 13:09:44 -0500 Subject: [PATCH] f3probe: avoid division by zero Since some fake drives do not require resets, the option --time-ops was triggering a division by zero for those drives. --- f3probe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/f3probe.c b/f3probe.c index f68533e..5789a58 100644 --- a/f3probe.c +++ b/f3probe.c @@ -352,7 +352,8 @@ static void report_ops(const char *op, uint64_t count, uint64_t time_us) { printf("Probe %s op: count=%" PRIu64 ", total time=%.2fs, avg op time=%.2fms\n", - op, count, time_us / 1e6, (time_us / count) / 1e3); + op, count, time_us / 1e6, + count > 0 ? (time_us / count) / 1e3 : 0.0); } static int test_device(struct args *args)