implement time measurement.