I am creating threads and each thread will do some task and write consumed time; which it takes to complete a task, in a single file. I cannot use locks because if a thread go into waiting state I cannot measure exact time the thread takes to complete the task.
Is there any solution that I can track the exact time taken by threads to complete the task. Task is to run a function having some time-consuming work.