title: how to measure execution time of functions (automatically) in Python
body: <p>I need to have a <em>base class</em> which I will use to inherit other classes which I would like to measure execution time of its functions.</p>
  
  <p>So <strong>intead of</strong> having something like this:</p>
  
  <pre><code>class Worker():
      def doSomething(self):
          start = time.time()
          ... do something
          elapsed = (time.time() - start)
          print "doSomething() took ", elapsed, " time to finish"
  
  #outputs: doSomething() took XX time to finish
  </code></pre>
  
  <p>I would like to have something like this:</p>
  
  <pre><code>class Worker(BaseClass):
      def doSomething(self):
          ... do something
  
  #outputs the same: doSomething() took XX time to finish
  </code></pre>
  
  <p>So the BaseClass needs to dealing with measuring time</p>