Add option to record the overheads in running a task.