Added function for counting cpu-time.