summaryrefslogtreecommitdiff
path: root/tools/dev/profile_docutils.py
diff options
context:
space:
mode:
authorwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2006-01-09 20:44:25 +0000
committerwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2006-01-09 20:44:25 +0000
commitd77fdfef70e08114f57cbef5d91707df8717ea9f (patch)
tree49444e3486c0c333cb7b33dfa721296c08ee4ece /tools/dev/profile_docutils.py
parent53cd16ca6ca5f638cbe5956988e88f9339e355cf (diff)
parent3993c4097756e9885bcfbd07cb1cc1e4e95e50e4 (diff)
downloaddocutils-0.4.tar.gz
Release 0.4: tagging released revisiondocutils-0.4
git-svn-id: http://svn.code.sf.net/p/docutils/code/tags/docutils-0.4@4268 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'tools/dev/profile_docutils.py')
-rwxr-xr-xtools/dev/profile_docutils.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/dev/profile_docutils.py b/tools/dev/profile_docutils.py
new file mode 100755
index 000000000..1f79c655e
--- /dev/null
+++ b/tools/dev/profile_docutils.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python -i
+
+# Author: Felix Wiemann
+# Contact: Felix_Wiemann@ososo.de
+# Revision: $Revision$
+# Date: $Date$
+# Copyright: This script has been placed in the public domain.
+
+import os.path
+import docutils.core
+import hotshot.stats
+
+print 'Profiler started.'
+
+os.chdir(os.path.join(os.path.dirname(docutils.__file__), '..'))
+
+print 'Profiling...'
+
+prof = hotshot.Profile('docutils.prof')
+prof.runcall(docutils.core.publish_file, source_path='HISTORY.txt',
+ destination_path='prof.HISTORY.html', writer_name='html')
+prof.close()
+
+print 'Loading statistics...'
+
+print """
+stats = hotshot.stats.load('docutils.prof')
+stats.strip_dirs()
+stats.sort_stats('time') # 'cumulative'; 'calls'
+stats.print_stats(40)
+"""
+
+stats = hotshot.stats.load('docutils.prof')
+stats.strip_dirs()
+stats.sort_stats('time')
+stats.print_stats(40)
+
+try:
+ execfile(os.environ['PYTHONSTARTUP'])
+except:
+ pass