Measuring latency in virtual environments