 <p>If you suspect that some other process or thread in your app is taking too much CPU time then use:</p> <p>GetThreadTimes under windows </p> <p>or</p> <p>clock_gettime with CLOCK_THREAD_CPUTIME_ID under linux</p> <p>to measure threads CPU time your function was being executed. This will exclude from your measurements time other threads/processes were executed during profiling.</p>