0 Replies Latest reply on Apr 12, 2016 8:50 AM by mlanoe

    Rouding error when computing svctm

    mlanoe Lurker



      I did some comparisons between Sigar and Linux iostat and I feel that the 'svctm' value computed by Sigar is not the same because of a rounding error.


      Here below is the result on my computer:


      Sigar iostat: svctm=0.05

      Linux iostat: svctm=1.31


      A manual computation using /proc/diskstats shows that the actual value of svctm is 1.31.


      The value is computed with these following formulas in linux_sigar.c:


      tput = ((double)ios) * HZ / interval;

      util = ((double)(disk->time - iodev->disk.time)) / interval * HZ;

      disk->service_time = tput ? util / tput : 0.0;


      I think it would be better to use this following formula to avoid rounding error:


      disk->service_time = ios ? ((double)(disk->time - iodev->disk.time)) / ((double)ios) : 0.0;


      What do you think about it?