title: Get time of execution of a block of code in Python 2.7
body: <p>I would like to measure the time elapsed to evaluate a block of code in a Python program,
  possibly separating between user cpu time, system cpu time and elapsed time.</p>
  
  <p>I know the <code>timeit</code> module, but I have many self-written functions and it is not very easy
  to pass them in the setup process.</p>
  
  <p>I would rather have something that could be used like:</p>
  
  <pre><code>#up to here I have done something....
  start_counting() #or whatever command used to mark that I want to measure
                     #the time elapsed in the next rows
  # code I want to evaluate
  user,system,elapsed = stop_counting() #or whatever command says:
                                        #stop the timer and return the times
  </code></pre>
  
  <p>The user and system CPU times are not essential (though I would like to measure them),
  but for the elapsed time I would like to be able to do something like this, 
  rather than using complicated commands or modules.                            </p>