[Zope-Checkins] CVS: Zope/lib/python/App - ApplicationManager.py:1.81.6.1
Andreas Jung
andreas@andreas-jung.com
Wed, 13 Nov 2002 05:29:56 -0500
Update of /cvs-repository/Zope/lib/python/App
In directory cvs.zope.org:/tmp/cvs-serv12020/lib/python/App
Modified Files:
Tag: Zope-2_6-branch
ApplicationManager.py
Log Message:
- Collector #670: applied patch from Dieter Maurer to enhance
the Zope profiling support
=== Zope/lib/python/App/ApplicationManager.py 1.81 => 1.81.6.1 ===
--- Zope/lib/python/App/ApplicationManager.py:1.81 Wed Aug 14 17:31:40 2002
+++ Zope/lib/python/App/ApplicationManager.py Wed Nov 13 05:29:55 2002
@@ -175,15 +175,19 @@
manage_profile=DTMLFile('dtml/profile', globals())
- def manage_profile_stats(self, sort='time', limit=200):
+ def manage_profile_stats(self, sort='time', limit=200, stripDirs=1, mode='stats'):
"""Return profile data if available"""
stats=getattr(sys, '_ps_', None)
if stats is None:
return None
output=StringIO()
stdout=sys.stdout
+ if stripDirs:
+ from copy import copy; stats= copy(stats)
+ stats.strip_dirs()
+ stats.sort_stats(sort)
sys.stdout=output
- stats.strip_dirs().sort_stats(sort).print_stats(limit)
+ getattr(stats,'print_%s' % mode)(limit)
sys.stdout.flush()
sys.stdout=stdout
return output.getvalue()