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.
This commit is contained in:
Michel Machado 2015-11-16 13:09:44 -05:00
parent e7769bb77d
commit 08dd0e9061

View File

@ -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)