added time measurement of loop