Author: Richard Plangger <r...@pasra.at> Branch: vecopt Changeset: r78260:5af70e37351c Date: 2015-06-23 14:31 +0200 http://bitbucket.org/pypy/pypy/changeset/5af70e37351c/
Log: moved around the timing to be able to translate the project with it diff --git a/rpython/jit/metainterp/compile.py b/rpython/jit/metainterp/compile.py --- a/rpython/jit/metainterp/compile.py +++ b/rpython/jit/metainterp/compile.py @@ -531,8 +531,7 @@ def handle_fail(self, deadframe, metainterp_sd, jitdriver_sd): # XXX debug purpose only - from rpython.jit.metainterp.optimizeopt.vectorize import xxx_clock_stop - xxx_clock_stop(jitdriver_sd, fail=True) + jitdriver_sd.xxxbench.xxx_clock_stop(fail=True) # XXX debug purpose only end if self.must_compile(deadframe, metainterp_sd, jitdriver_sd): self.start_compiling() diff --git a/rpython/jit/metainterp/jitdriver.py b/rpython/jit/metainterp/jitdriver.py --- a/rpython/jit/metainterp/jitdriver.py +++ b/rpython/jit/metainterp/jitdriver.py @@ -33,3 +33,4 @@ def _freeze_(self): return True + diff --git a/rpython/jit/metainterp/optimizeopt/vectorize.py b/rpython/jit/metainterp/optimizeopt/vectorize.py --- a/rpython/jit/metainterp/optimizeopt/vectorize.py +++ b/rpython/jit/metainterp/optimizeopt/vectorize.py @@ -6,6 +6,7 @@ """ import py +import time from rpython.jit.metainterp.resume import Snapshot from rpython.jit.metainterp.jitexc import JitException @@ -28,26 +29,6 @@ from rpython.rlib.jit import Counters from rpython.rtyper.lltypesystem import lltype, rffi -import time -XXXBench = {} -def xxx_clock_start(jitdriver_sd): - XXXBench[jitdriver_sd] = time.clock() -def xxx_clock_stop(jitdriver_sd, fail=False): - end = time.clock() - if jitdriver_sd not in XXXBench: - raise AssertionError("trying to stop clock but timing for jit driver sd has never started") - start = XXXBench[jitdriver_sd] - name = "<unkown>" - if jitdriver_sd.jitdriver: - name = jitdriver_sd.jitdriver.name - unique_id = jitdriver_sd - ns = (end - start) * 10**9 - debug_start("xxx-clock-stop") - debug_print("name: %s id(jdsd): %s exe time: %dns fail? %d vec? %d" % \ - (name, unique_id, int(ns), int(fail), int(jitdriver_sd.vectorize))) - debug_stop("xxx-clock-stop") - - def debug_print_operations(loop): """ NOT_RPYTHON """ if not we_are_translated(): @@ -63,7 +44,6 @@ else: print "" - class NotAVectorizeableLoop(JitException): def __str__(self): return 'NotAVectorizeableLoop()' diff --git a/rpython/jit/metainterp/warmspot.py b/rpython/jit/metainterp/warmspot.py --- a/rpython/jit/metainterp/warmspot.py +++ b/rpython/jit/metainterp/warmspot.py @@ -28,6 +28,33 @@ from rpython.rlib.entrypoint import all_jit_entrypoints,\ annotated_jit_entrypoints +from rpython.rlib.debug import debug_print, debug_start, debug_stop +import time + +# XXX XXX XXX +class XXXBench(object): + def __init__(self, name, id, vec): + self.t = [] + self.name = name + self.unique_id = id + self.vec = vec + + def xxx_clock_start(self): + self.t.append(time.clock()) + + def xxx_clock_stop(self, fail=False): + end = time.clock() + if len(self.t) == 0: + raise AssertionError("trying to stop clock but timing for jit driver sd has never started") + start = self.t[-1] + del self.t[-1] + ns = (end - start) * 10**9 + debug_start("xxx-clock-stop") + debug_print("name: %s id(jdsd): %s exe time: %dns fail? %d vec? %d" % \ + (self.name, self.unique_id, int(ns), int(fail), int(self.vec))) + debug_stop("xxx-clock-stop") + + # ____________________________________________________________ # Bootstrapping @@ -403,6 +430,9 @@ jd.portal_runner_ptr = "<not set so far>" jd.result_type = history.getkind(jd.portal_graph.getreturnvar() .concretetype)[0] + # XXX XXX XXX + jd.xxxbench = XXXBench(jd.jitdriver.name, id(jd), jd.vectorize) + # XXX XXX XXX self.jitdrivers_sd.append(jd) def check_access_directly_sanity(self, graphs): @@ -831,8 +861,7 @@ raise Exception, value finally: # XXX debug purpose only - from rpython.jit.metainterp.optimizeopt.vectorize import xxx_clock_stop - xxx_clock_stop(jd, fail=False) + jd.xxxbench.xxx_clock_stop(fail=False) # XXX debug purpose only end diff --git a/rpython/jit/metainterp/warmstate.py b/rpython/jit/metainterp/warmstate.py --- a/rpython/jit/metainterp/warmstate.py +++ b/rpython/jit/metainterp/warmstate.py @@ -369,8 +369,7 @@ virtualizable = args[index_of_virtualizable] vinfo.clear_vable_token(virtualizable) # XXX debug purpose only - from rpython.jit.metainterp.optimizeopt.vectorize import xxx_clock_start - xxx_clock_start(jitdriver_sd) + jitdriver_sd.xxxbench.xxx_clock_start() # XXX debug purpose only end deadframe = func_execute_token(loop_token, *args) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit