title: Python CPU Clock. time.clock() vs time.perf_counter() vs time.process_time()
body: <p>I wanted to measure how long sections of my code run. I needed this to be deterministic so that I get the same duration every time (seconds/milliseconds/etc) regardless of what is happening in the background. So i wanted to measure CPU time using time.clock() on unix.</p>
  <p>time.clock() has since been decrecated and its suggested to switch to either perf_counter or process_time. I was looking at the python doc and found the following.</p>
  <blockquote>
  <p>time.perf_counter() → float Return the value (in fractional seconds)
  of a performance counter, i.e. a clock with the highest available
  resolution to measure a short duration. It does include time elapsed
  during sleep and is system-wide. The reference point of the returned
  value is undefined, so that only the difference between the results of
  consecutive calls is valid.</p>
  <p>time.process_time() → float Return the value (in fractional seconds)
  of the sum of the system and user CPU time of the current process. It
  does not include time elapsed during sleep. It is process-wide by
  definition. The reference point of the returned value is undefined, so
  that only the difference between the results of consecutive calls is
  valid.</p>
  </blockquote>
  <p>Since I am not using any form of sleep in my code, the primary difference seems to be 'process-wide' and 'system-wide'. Could sometime elaborate the difference?</p>
  <p>Secondly, is this the correct way to do this?</p>