Measure and log duration.