pull out a latency calculation to a method