title: Calculate execution time for every page in Python's Flask
body: <p>What's a good way to calculate the execution time for every page load using Python's Flask library?</p>
  
  <p>I was thinking of putting a start timer in views/__ init__.py:</p>
  
  <pre><code>@app.before_request
  def before_request():
    g.start = time.time()
  </code></pre>
  
  <p>But where would I put the end part of the timer to calculate the difference, and how would I get it into the footer of my html template?</p>
  
  <p>Thanks.</p>