[pypy-svn] r68887 - in pypy/branch/logging2/pypy/jit/metainterp: . test

arigo at codespeak.net arigo at codespeak.net
Sun Nov 1 14:41:12 CET 2009


Author: arigo
Date: Sun Nov  1 14:41:11 2009
New Revision: 68887

Modified:
   pypy/branch/logging2/pypy/jit/metainterp/jitprof.py
   pypy/branch/logging2/pypy/jit/metainterp/test/test_jitprof.py
Log:
Disable timing the "Running asm" and "Blackhole" parts.  Thanks mwhudson
for leading me to notice that it actually makes a serious slowdown,
particularly on virtual machines, to call time.time() extremely often.

This is checked in in the logger2 branch because the same info can still
be obtained via logging if needed.


Modified: pypy/branch/logging2/pypy/jit/metainterp/jitprof.py
==============================================================================
--- pypy/branch/logging2/pypy/jit/metainterp/jitprof.py	(original)
+++ pypy/branch/logging2/pypy/jit/metainterp/jitprof.py	Sun Nov  1 14:41:11 2009
@@ -91,7 +91,7 @@
     def start(self):
         self.starttime = self.timer()
         self.t1 = self.starttime
-        self.times = [0, 0, 0, 0]
+        self.times = [0, 0]
         self.counters = [0] * ncounters
         self.calls = [[0, 0], [0, 0], [0, 0]]
         self.current = []
@@ -130,11 +130,11 @@
     def start_backend(self):   self._start(BACKEND)
     def end_backend(self):     self._end  (BACKEND)
 
-    def start_running(self):   self._start(RUNNING)
-    def end_running(self):     self._end  (RUNNING)
+    def start_running(self): self.count(RUNNING)
+    def end_running(self):   pass
 
-    def start_blackhole(self): self._start(BLACKHOLE)
-    def end_blackhole(self):   self._end  (BLACKHOLE)
+    def start_blackhole(self): self.count(BLACKHOLE)
+    def end_blackhole(self):   pass
 
     def count(self, kind, inc=1):
         self.counters[kind] += inc        
@@ -153,8 +153,8 @@
         calls = self.calls
         self._print_line_time("Tracing", cnt[TRACING],   tim[TRACING])
         self._print_line_time("Backend", cnt[BACKEND],   tim[BACKEND])
-        self._print_line_time("Running asm", cnt[RUNNING],   tim[RUNNING])
-        self._print_line_time("Blackhole", cnt[BLACKHOLE], tim[BLACKHOLE])
+        self._print_intline("Running asm", cnt[RUNNING])
+        self._print_intline("Blackhole", cnt[BLACKHOLE])
         line = "TOTAL:      \t\t%f\n" % (self.tk - self.starttime, )
         os.write(2, line)
         self._print_intline("ops", cnt[OPS])

Modified: pypy/branch/logging2/pypy/jit/metainterp/test/test_jitprof.py
==============================================================================
--- pypy/branch/logging2/pypy/jit/metainterp/test/test_jitprof.py	(original)
+++ pypy/branch/logging2/pypy/jit/metainterp/test/test_jitprof.py	Sun Nov  1 14:41:11 2009
@@ -6,9 +6,11 @@
 from pypy.jit.metainterp.jitprof import *
 
 class FakeProfiler(Profiler):
-    def __init__(self):
+    def start(self):
         self.counter = 123456
+        Profiler.start(self)
         self.events = []
+        self.times = [0, 0, 0, 0]
     
     def timer(self):
         self.counter += 1
@@ -22,6 +24,12 @@
         Profiler._end(self, event)
         self.events.append(~event)
 
+    def start_running(self):   self._start(RUNNING)
+    def end_running(self):     self._end(RUNNING)
+
+    def start_blackhole(self): self._start(BLACKHOLE)
+    def end_blackhole(self):   self._end(BLACKHOLE)
+
 class ProfilerMixin(LLJitMixin):
     def meta_interp(self, *args, **kwds):
         kwds = kwds.copy()



More information about the Pypy-commit mailing list