-1

I'm using Python Bottle.

What would be an efficient way to measure and display the page generation time? (i.e. more or less server time used)

Of course, something like:

start = time.time()

...

generationtime = time.time() - start

would work, but where to put it on a page? Where is exactly the start (earliest point where request arrives), and when is the latest point before sending to client?

Basj
  • 41,386
  • 99
  • 383
  • 673
  • Well, _page generation time_, to my mind, can't be measured entirely on the server: for example, your page may contain some JS code working hard modifying the DOM, and this takes time as well. If you want to measure the time spent to craft the webpage _on the server_, first, generate it and then, right before sending, insert the time into it. – ForceBru May 12 '16 at 09:36
  • Your question "where to put it on a page" makes me think you have JavaScript in mind. But that's inconsistent with your comment "before sending it to client." Can you clarify? – ron rothman May 13 '16 at 01:26

1 Answers1

-1

You want to use @hook('before_request') in bottle.

eatmeimadanish
  • 3,809
  • 1
  • 14
  • 20