[Zodb-checkins] CVS: StandaloneZODB/bsddb3Storage/bsddb3Storage - profout.py:1.2
Barry Warsaw
barry@wooz.org
Fri, 23 Aug 2002 13:15:17 -0400
Update of /cvs-repository/StandaloneZODB/bsddb3Storage/bsddb3Storage
In directory cvs.zope.org:/tmp/cvs-serv1668/bsddb3Storage
Added Files:
profout.py
Log Message:
A little script to help analyze hotshot output.
=== StandaloneZODB/bsddb3Storage/bsddb3Storage/profout.py 1.1 => 1.2 ===
--- /dev/null Fri Aug 23 13:15:17 2002
+++ StandaloneZODB/bsddb3Storage/bsddb3Storage/profout.py Fri Aug 23 13:15:16 2002
@@ -0,0 +1,23 @@
+import os
+import pprint
+from hotshot.log import LogReader
+
+prevloc = None
+byline = {}
+log = LogReader('profile.dat')
+
+for what, place, tdelta in log:
+ byline[prevloc] = tdelta + byline.get(prevloc, 0)
+ byline.setdefault(place,0)
+ prevloc = place
+
+# Sort
+results = [(v, k) for k, v in byline.items()]
+results.sort()
+
+for usecs, place in results:
+ if not place:
+ print 'Bad unpack:', usecs, place
+ continue
+ filename, line, funcname = place
+ print '%08d' % usecs, os.path.split(filename)[1], line