How to measure times in multi-thread programs in C


I'm doing multithreaded work in c, and I need to time a certain part of the program, does anyone have any idea how I can do this?


Yes, what you want to do has a name, it's called profiling . Take a quick read HERE to better understand what this technique means.

This is often used to improve codes that need to have high performance, little used in real life as a programmer, but a very interesting technique to know.

Use the gprof tool to do this.

Good luck!

Scroll to Top