diff --git a/gluon/main.py b/gluon/main.py
index b3c37fb..190ead8 100644
--- a/gluon/main.py
+++ b/gluon/main.py
@@ -435,6 +435,10 @@ def wsgibase(environ, responder):
[a-zA-Z0-9_]
- file and sub may also contain '-', '=', '.' and '/'
"""
+ import cProfile
+
+ prof = cProfile.Profile()
+ prof.enable()
current.__dict__.clear()
request = Request()
@@ -689,6 +693,8 @@ def wsgibase(environ, responder):
return wsgibase(new_environ, responder)
if global_settings.web2py_crontype == 'soft':
newcron.softcron(global_settings.applications_parent).start()
+ prof.disable()
+ prof.dump_stats('/tmp/web2py-profiling/prof-' + str(time.time()) + '.prof')
8<----------------------------------------8<--------------------------