Ethereal-dev: Re: [Ethereal-dev] timestamp resolution of various OSes ...

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Ronnie Sahlberg" <ronnie_sahlberg@xxxxxxxxxxxxxx>
Date: Wed, 12 Nov 2003 20:41:33 +1100
On modern linux kernels on x86 platforms I belive it will use the cycle
conter of the cpu for timestamps.
It does usually provide pretty good sub ms resolution.

Older platforms often have the resolution set to the HZ value of the OS.


For response times in ethereal,
the timestamp accuracy is important for individual measurements of response
times.
However, if there are many samples (many response times) then for things
like Average response times
for the Service Response time thing the accuracy of the timestam,ps get less
important.


Say 10ms resolution, this means that the smallest non-zero time delta we can
detect in the capture is 10ms.
It means that service response times for individual command/response pairs
are either 0 or an integer multiple of 10ms.
Assuming the real response time nomrally is 1 ms this givces us  a measured
value either of 0 or 10 ms.
Pretty poor or useless timestamp resolution if we look at individual
transactions!

However if we look at averager it all changes.
Assume the real response time is 1ms (on average)
Assume the timestamp resolution is 10ms.
Then depending on whether the Call-Response is covering a timer-increase
event or not, the response time according to the timestamps in the capture
will be either 0 or 10ms.
If the real response time is 1ms and the resolution is 10ms  the probability
of one such transaction actually overlapping with when teh timer increases
would be 10%.
=>  1ms response time,   10ms resolution  =>   10% probability that in the
capture it will be represented as a 10ms response time
and a 90% probability it will be represetned as a 0ms response time.

Take a large number of response times and it will all even out so that we
get very accurate AVERAGE response times even if the individual
timestamp resolution is inadequate.


I could ask my wife to set up some formula on probabilites and getting a 95%
confidence interval on the resolution of the average
based on the value of the average, the resolution of timestamps and the
number of samples (she's a statistician, im the mathematician of the family)
but fear that would be overkill for our applications.


I just go by my own rule of thumb:  Take timestamp resolution, divide by
AVERAGE response time multiply by the number of samples, then take log10 of
that value, truncate it  and it will give me with hopefully reasonable
accuracy the number of significant digits in the average.
One measured response time is one sample.

Example:
1000 samples    Average is 3.000ms   Timestamp resolution is 10ms
10/3*1000 ~=300
log10(300) ~= 2.xx
truncated value: 2
two most significant digits of 3.000  is 3.0

Thus I assume that the real average is ~3.0ms


For extra safety when it is real important, drop one extra digit of
precision.


I find this easy to perform approximation a simple and quick way to
estimate, with reasonable confidency, what the real average is.

(As an extra safeguard, I never consider any AVERAGE values meaningful
unless the log10() above yields a value of at least 1.5)







----- Original Message ----- 
From: "Richard Sharpe" <rsharpe@xxxxxxxxxxxxxxxxx>
To: <ethereal-dev@xxxxxxxxxxxx>
Sent: Wednesday, November 12, 2003 7:50 PM
Subject: [Ethereal-dev] timestamp resolution of various OSes ...


> Hi,
>
> What can be said, and where can I find info on, about the timestamp
> resolution of various OSes wrt libpcap.
>
> I notice FreeBSD gives microsecond resolution, at least. I am not sure
> about Linux, Solaris, etc.
>
> Can anyone help here?
>
> Regards
> -----
> Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org,
> sharpe[at]ethereal.com, http://www.richardsharpe.com
>
> _______________________________________________
> Ethereal-dev mailing list
> Ethereal-dev@xxxxxxxxxxxx
> http://www.ethereal.com/mailman/listinfo/ethereal-dev