I’ve read this short guide on profiling using Werkzeug Middleware. It appears to profile only response times after the app has started, whereas I am also interested in looking at my app’s initialisation performance. (why? I am considering killing Gunicorn workers or restarting the arbiter as a way to consistently update data across them)
In particular, I’d like to know how fast my pages/page_*.py
are imported. So far, I had to manually clock the overall time by using datetime.now()
in the beginning and the end of each page file. I reckon I could also put everything inside layout()
and use the aforementioned Werkzeug middleware recipe, but this would be less representative of my app performance in the wild.
Is there a better way to clock each page’s initialisation time?