projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
idletime: fix potential divide-by-zero
[fio.git]
/
idletime.c
diff --git
a/idletime.c
b/idletime.c
index c0bc0bfce19675e311fcbd7394540b02a7010eba..bc8097680d69f37b139495b61f56287b588c9693 100644
(file)
--- a/
idletime.c
+++ b/
idletime.c
@@
-336,7
+336,10
@@
void fio_idle_prof_stop(void)
/* calculate idleness */
if (ipc.cali_mean != 0.0) {
runt = utime_since(&ipt->tps, &ipt->tpe);
/* calculate idleness */
if (ipc.cali_mean != 0.0) {
runt = utime_since(&ipt->tps, &ipt->tpe);
- ipt->idleness = ipt->loops * ipc.cali_mean / runt;
+ if (runt)
+ ipt->idleness = ipt->loops * ipc.cali_mean / runt;
+ else
+ ipt->idleness = 0.0;
} else
ipt->idleness = 0.0;
}
} else
ipt->idleness = 0.0;
}