Add latency calculation