[pypy-svn] r64946 - pypy/branch/pyjitpl5/pypy/jit/metainterp

arigo at codespeak.net arigo at codespeak.net
Fri May 1 17:29:03 CEST 2009


Author: arigo
Date: Fri May  1 17:29:02 2009
New Revision: 64946

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/jitprof.py
Log:
Print also the number of times we called start_xxx(),
to get an idea.


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/jitprof.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/jitprof.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/jitprof.py	Fri May  1 17:29:02 2009
@@ -50,6 +50,7 @@
         self.starttime = self.timer()
         self.t1 = self.starttime
         self.times = [0, 0, 0, 0]
+        self.counters = [0, 0, 0, 0]
         self.current = []
 
     def finish(self):
@@ -61,6 +62,7 @@
         self.t1 = self.timer()
         if self.current:
             self.times[self.current[-1]] += self.t1 - t0
+        self.counters[event] += 1
         self.current.append(event)
 
     def _end(self, event):
@@ -86,11 +88,13 @@
     def end_blackhole(self):   self._end  (BLACKHOLE)
 
     def print_stats(self):
-        print "Tracing:     %f" % self.times[TRACING]
-        print "Backend:     %f" % self.times[BACKEND]
-        print "Running asm: %f" % self.times[RUNNING]
-        print "Blackhole:   %f" % self.times[BLACKHOLE]
-        print "TOTAL:       %f" % (self.tk - self.starttime)
+        cnt = self.counters
+        tim = self.times
+        print "Tracing:    \t%d\t%f" % (cnt[TRACING],   tim[TRACING])
+        print "Backend:    \t%d\t%f" % (cnt[BACKEND],   tim[BACKEND])
+        print "Running asm:\t%d\t%f" % (cnt[RUNNING],   tim[RUNNING])
+        print "Blackhole:  \t%d\t%f" % (cnt[BLACKHOLE], tim[BLACKHOLE])
+        print "TOTAL:      \t\t%f" % (self.tk - self.starttime)
 
 
 class BrokenProfilerData(Exception):



More information about the Pypy-commit mailing list