updated script for measuring avg latencies