Add logic to measure time.