예제 #1
0
    def setup_method(self, meth):
        visited = []

        def helper():
            trace = []
            stack = cintf.vmprof_tl_stack.getraw()
            while stack:
                trace.append((stack.c_kind, stack.c_value))
                stack = stack.c_next
            visited.append(trace)

        llfn = llhelper(lltype.Ptr(lltype.FuncType([], lltype.Void)), helper)

        class CodeObj(object):
            def __init__(self, name):
                self.name = name

        def get_code_fn(codes, code, arg, c):
            return code

        def get_name(code):
            return "foo"

        _get_vmprof().use_weaklist = False
        register_code_object_class(CodeObj, get_name)

        self.misc = visited, llfn, CodeObj, get_code_fn, get_name
예제 #2
0
    def setup_method(self, meth):
        visited = []

        def helper():
            trace = []
            stack = cintf.vmprof_tl_stack.getraw()
            while stack:
                trace.append((stack.c_kind, stack.c_value))
                stack = stack.c_next
            visited.append(trace)

        llfn = llhelper(lltype.Ptr(lltype.FuncType([], lltype.Void)), helper)

        class CodeObj(object):
            def __init__(self, name):
                self.name = name

        def get_code_fn(codes, code, arg, c):
            return code

        def get_name(code):
            return "foo"

        _get_vmprof().use_weaklist = False
        register_code_object_class(CodeObj, get_name)

        self.misc = visited, llfn, CodeObj, get_code_fn, get_name
예제 #3
0
 def test_fixture(self, fakevmprof):
     assert isinstance(fakevmprof, FakeVMProf)
     assert rvmprof._get_vmprof() is fakevmprof
     #
     # tweak sampling using the "real" API, and check that we actually used
     # the fake
     rvmprof.start_sampling()
     assert fakevmprof.is_sampling_enabled
     rvmprof.stop_sampling()
     assert not fakevmprof.is_sampling_enabled
예제 #4
0
 def teardown_method(self, meth):
     del _get_vmprof().use_weaklist
예제 #5
0
 def teardown_method(self, meth):
     del _get_vmprof().use_weaklist