title: How do I measure the time my function, and only my function is using the CPU
body: <p>I am using GCC on ubuntu, and I want a function that does measures the time that my function uses the CPU. I do not want to include the time that the CPU spent on background processes.</p>
  
  <p>For example, if my function used the CPU for 10 ms, then the processor processed some other data for 20 ms, then continued working on my function for 8 ms. I want it to return 18ms, not 38. I don't mind if the result was in CPU ticks.</p>