tests: Factor time measurement code out.