Exemplo n.º 1
0
def patch_interpreter():
    from rpython.rlib import rvmprof
    from rsqueakvm.interpreter import Interpreter

    def _get_code(interp, s_frame, s_sender, may_context_switch):
        return s_frame.w_method()
    _decorator = rvmprof.vmprof_execute_code("rsqueak", _get_code)
    _my_stack_frame = _decorator(Interpreter.stack_frame)
    Interpreter.stack_frame = _my_stack_frame
    print "Interpreter was patched for vmprof"
Exemplo n.º 2
0
    def patch_interpreter():
        from rpython.rlib import rvmprof
        from rsqueakvm.interpreter import Interpreter

        def _get_code(interp, s_frame, s_sender, may_context_switch=True):
            return s_frame.w_method()

        _decorator = rvmprof.vmprof_execute_code("rsqueak", _get_code)
        _my_stack_frame = _decorator(Interpreter.stack_frame)
        Interpreter.stack_frame = _my_stack_frame
        print "Interpreter was patched for vmprof"
Exemplo n.º 3
0
from pypy.interpreter.error import OperationError
from pypy.interpreter.gateway import unwrap_spec
from pypy.interpreter.pyframe import PyFrame
from pypy.interpreter.pycode import PyCode
from pypy.interpreter.baseobjspace import W_Root
from rpython.rlib import rvmprof

# ____________________________________________________________

_get_code = lambda frame, w_inputvalue, operr: frame.pycode
_decorator = rvmprof.vmprof_execute_code("pypy", _get_code, W_Root)
my_execute_frame = _decorator(PyFrame.execute_frame)


class __extend__(PyFrame):
    def execute_frame(self, w_inputvalue=None, operr=None):
        # indirection for the optional arguments
        return my_execute_frame(self, w_inputvalue, operr)


def _safe(s):
    if len(s) > 110:
        s = s[:107] + '...'
    return s.replace(':', ';')


def _get_full_name(pycode):
    # careful, must not have extraneous ':' or be longer than 255 chars
    return "py:%s:%d:%s" % (_safe(
        pycode.co_name), pycode.co_firstlineno, _safe(pycode.co_filename))
Exemplo n.º 4
0
from pypy.interpreter.error import OperationError
from pypy.interpreter.gateway import unwrap_spec
from pypy.interpreter.pyframe import PyFrame
from pypy.interpreter.pycode import PyCode
from pypy.interpreter.baseobjspace import W_Root
from rpython.rlib import rvmprof, jit

# ____________________________________________________________


_get_code = lambda frame, w_inputvalue, operr: frame.pycode
_decorator = rvmprof.vmprof_execute_code("pypy", _get_code, W_Root)
my_execute_frame = _decorator(PyFrame.execute_frame)


class __extend__(PyFrame):
    def execute_frame(self, w_inputvalue=None, operr=None):
        # indirection for the optional arguments
        return my_execute_frame(self, w_inputvalue, operr)


def _safe(s):
    if len(s) > 110:
        s = s[:107] + '...'
    return s.replace(':', ';')

def _get_full_name(pycode):
    # careful, must not have extraneous ':' or be longer than 255 chars
    return "py:%s:%d:%s" % (_safe(pycode.co_name), pycode.co_firstlineno,
                            _safe(pycode.co_filename))