measure latency in milliseconds