What's a good way to calculate the execution time for every page load using Python's Flask library?

I was thinking of putting a start timer in views/__ init__.py:

@app.before_request
def before_request():
  g.start = time.time()

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?

Thanks.

Edit
Report