Negative value of latency

• 05-07-2009
archayl
Negative value of latency
Hello all,

I've done some measurement on some system using Linux about latency. Measurement is based on periodic activation of processes.

Latency = (Current Activation TIme - Previous Activation TIme) - Period Of Activation

I would like to know if this formula is valid. If not, please correct me. Another issue is the results I've obtained contains negative latency value. I've looked around the web but unfortunately can't find the explanation of the existence of the negative value. I really would like to know what causes the negative value. It would be very appreciated if anyone can explain about this. Thanks.
• 05-07-2009
Themer
Correct me if I'm wrong, but isn't latency the delay between 2 things, like, for example, the milliseconds in between connections to the server when running a network game? So, shouldn't the latency be calculated by subtracting the first time from the current time? say:
Code:

`Current time - previous time = latency`
where "previous time" is when the last occurrence of the event you want to test was.

The lower the resulting value, the faster, or less delay, there was between the events. Ideally, it should be as close to zero as possible, but it can never be zero, or below of course, unless you were testing your system in a black hole or something... :p
• 05-08-2009
archayl
Im sorry for the mistake. I've found out that the negative values are the results of wrong formula. As I'm running periodic task, the calculation should be like this.

latency = current_time - (index_of_activation x period_of_activation - first_activation_time)

This will never yield negative value. It is a periodic activation. The delay should not be measured based on previous activation time, instead, it should be measured by the time scale, that is the how-many-time-the-process-have-been-activated times the period between activation.

For example, 250ms activation period and 200 activation points.
At activation point 1, the delay is 30ms. At activation point 2, the delay is 0ms.

Using this formula,
Latency(Index) = (Current Activation TIme - Previous Activation TIme) - Period Of Activation

Latency(1) = (280-0)-250 = 30ms
Latency(2) = (500-280)-250 = -30ms

But,

latency(index) = current_time - (index_of_activation x period_of_activation - first_activation_time)

latency(1) = 280 - (1x250-0) = 30ms
latency(2) = 500 - (2x250-0) = 0ms

so, the first one is invalid. The second one is the valid latency. Hence, negative value of latency will never exist.

For Themer, sorry for the mistake. The equation on the first post should be like this.

Latency = (Current Activation TIme - Previous Activation TIme) - Period Of Activation

I'll edit it. Thanks anyway.