Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: value-profiling Changeset: r78898:77cb21016bed Date: 2015-08-11 16:17 +0200 http://bitbucket.org/pypy/pypy/changeset/77cb21016bed/
Log: (arigo, cfbolz): temporarily add some debug printing diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py --- a/pypy/interpreter/pycode.py +++ b/pypy/interpreter/pycode.py @@ -95,7 +95,7 @@ self._signature = cpython_code_signature(self) self._initialize() self._init_ready() - self.vprofs = [ValueProf() for i in range(self.co_nlocals)] + self.vprofs = [ValueProf('%s %s' % (self.co_name, self.co_varnames[i])) for i in range(self.co_nlocals)] def _initialize(self): if self.co_cellvars: diff --git a/pypy/interpreter/valueprof.py b/pypy/interpreter/valueprof.py --- a/pypy/interpreter/valueprof.py +++ b/pypy/interpreter/valueprof.py @@ -10,14 +10,16 @@ _mixin_ = True _immutable_fields_ = ['_vprof_status?'] - def __init__(self): + def __init__(self, msg=''): # only if you subclass normally - self.init_valueprof() + self.init_valueprof(msg) - def init_valueprof(self): + def init_valueprof(self, msg=''): self._vprof_status = SEEN_NOTHING self._vprof_value_int = 0 self._vprof_value_wref = dead_ref + self._vprof_counter = 0 + self._vprof_msg = msg def is_int(self, w_obj): raise NotImplementedError("abstract base") @@ -38,6 +40,10 @@ elif status == SEEN_INT: if self.read_constant_int() != value: self._vprof_status = SEEN_TOO_MUCH + else: + self._vprof_counter += 1 + if self._vprof_counter == 200: + print self._vprof_msg, 'int', value elif status == SEEN_OBJ: self._vprof_status = SEEN_TOO_MUCH @@ -58,6 +64,10 @@ elif status == SEEN_OBJ: if self.try_read_constant_obj() is not value: self._vprof_status = SEEN_TOO_MUCH + else: + self._vprof_counter += 1 + if self._vprof_counter == 200: + print self._vprof_msg, 'obj', value def can_fold_read_int(self): return self._vprof_status == SEEN_INT diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py --- a/pypy/objspace/std/mapdict.py +++ b/pypy/objspace/std/mapdict.py @@ -297,7 +297,7 @@ self.back = back self._size_estimate = self.length() * NUM_DIGITS_POW2 self.ever_mutated = False - self.init_valueprof() + self.init_valueprof('%s.%s' % (back.terminator.w_cls.name, selector[0])) # ____________________________________________________________ # methods for ValueProf mixin _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit