Move time measurements into tests

To lower the overheads incorporated in the measurements.