I've been using repoze.profile.profiler's
AccumulatingProfileMiddleware configured to discard the first request
(to avoid template compilation and buried import statement overhead on
the initial request). I use the following code in my <pkg>/config/
middleware.py: make_app function:
from repoze.profile.profiler import
AccumulatingProfileMiddleware
app = AccumulatingProfileMiddleware(
app,
log_filename = config.get('web.profile.log',
'profile.prof'),
discard_first_request = asbool(config.get
('web.profile.discard', 'true')),
flush_at_shutdown = asbool(config.get
('web.profile.flush', 'true')),
path = config.get('web.profile.path', '/__profile__')
)
— Alice.