When we give out some statistics in blkiomon, we don't consider
the situation that the device has no correspoinding action. See
if there is no disk read during the interval, the output in my box is
like:
sizes read (bytes): num 0, min -1, max 0, sum 0, squ 0, avg nan, var nan
With the fix, now it looks like:
sizes read (bytes): num 0, min -1, max 0, sum 0, squ 0, avg 0.0, var 0.0
Cc: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
static inline double minmax_avg(struct minmax *mm)
{
+ if (!mm->num)
+ return 0;
+
return (mm->sum / (double)mm->num);
}
{
double num = (double)mm->num;
+ if (!mm->num)
+ return 0;
+
return ((mm->sos - ((mm->sum * mm->sum) / num)) / num);
}