title: accurately measure time python function takes
body: <p>I need to measure the time certain parts of my program take (not for debugging but as a feature in the output). Accuracy is important because the total time will be a fraction of a second.</p>
  
  <p>I was going to use the <a href="http://docs.python.org/library/time.html" rel="noreferrer">time module</a> when I came across <a href="http://docs.python.org/library/timeit.html" rel="noreferrer">timeit</a>, which claims to <em>avoid a number of common traps for measuring execution times</em>. Unfortunately it has an awful interface, taking a string as input which it then eval's. </p>
  
  <p>So, do I need to use this module to measure time accurately, or will time suffice? And what are the pitfalls it refers to?</p>
  
  <p>Thanks</p>