Add support for measuring latency

Enable with --latency