Hi Robert,

Robert Luberda wrote:
I'm forwarding bug report I got during my holidays.
I can reproduce the behaviour with sysstat 7.0.0.
I haven't checked however if the attached patch is correct and works.

<SNIP>
sar -s hh:mm:ss should return data after the specified time, however
it effectively skips the first record:

# sar -d |tail -n 5
14:06:08       dev8-0      0.92      0.00     18.54     20.22 0.00      0.60    
  0.18      0.02
14:07:08       dev8-0      0.58      0.00     13.20     22.63 0.00      0.23    
  0.20      0.01
14:08:08       dev8-0      1.57      0.00     36.26     23.15 0.00      1.52    
  0.17      0.03
14:09:08       dev8-0      0.77      0.00     17.87     23.30 0.00      0.22    
  0.09      0.01
Average:       dev8-0      0.89      0.00     20.64     23.19 0.00      0.75    
  0.22      0.02

# sar -d -s 14:08:00
Linux 2.6.8-2-686 (IS-844)      20/07/06

14:08:08          DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz avgqu-sz     
await     svctm     %util
14:09:08       dev8-0      0.77      0.00     17.87     23.30 0.00      0.22    
  0.09      0.01
Average:       dev8-0      0.77      0.00     17.87     23.30 0.00      0.22    
  0.09      0.01

# sar -d -s 14:09:00 |tail
Linux 2.6.8-2-686 (IS-844)      20/07/06

This behavior of sar may seem a bit ambiguous, I must admit, but it's not a bug. Here is the explanation: 1) First, sar only displays stats on a complete interval of time. So if you set the starting time to 14:08:00 in the example above, sar will begin to display the stats at 14:08:08. 2) Then, the values displayed by sar are not instantaneous values, but rather values calculated on an interval of time. The stats displayed at time T are calculated on the interval ]T-dt;T] where dt is the sampling interval. That's why when you enter "-s 14:08:00" on the command line, the first line of stats displayed is for 14:09:08 which is actually the stats calculated from 14:08:08 to 14:09:08... and which is what you asked for (OK, to be very accurate, the interval from 14:08:00 to 14:08:08 is missing, but sar doesn't know how to compute the stats for it since it is only a fraction of the interval.)

Regards,

--
Sébastien Godard (sysstat <at> wanadoo.fr)
http://perso.orange.fr/sebastien.godard/



Reply via email to