Home - Summaries: (main) : (py3.11) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

jit/backend/x86/test/test_zrpy_vmprof.py::TestZVMprof::()::test_vmprof

self = <rpython.jit.backend.x86.test.test_zrpy_vmprof.TestZVMprof object at 0xf58e774c>

    def test_vmprof(self):
        from rpython.rlib import rvmprof
    
        class MyCode:
            _vmprof_unique_id = 0
            _vmprof_weak_list = RWeakListMixin() ; _vmprof_weak_list.initialize()
            def __init__(self, name):
                self.name = name
    
        def get_name(code):
            return code.name
    
        code2 = MyCode("py:y:foo:4")
        rvmprof.register_code(code2, get_name)
    
        try:
            rvmprof.register_code_object_class(MyCode, get_name)
        except rvmprof.VMProfPlatformUnsupported as e:
            py.test.skip(str(e))
    
        def get_unique_id(code):
            return rvmprof.get_unique_id(code)
    
        driver = JitDriver(greens = ['code'], reds = ['i', 's', 'num'],
            is_recursive=True, get_unique_id=get_unique_id)
    
        @rvmprof.vmprof_execute_code("xcode13", lambda code, num: code)
        def main(code, num):
            return main_jitted(code, num)
    
        def main_jitted(code, num):
            s = 0
            i = 0
            while i < num:
                driver.jit_merge_point(code=code, i=i, s=s, num=num)
                s += (i << 1)
                if i % 3 == 0 and code is not code2:
                    main(code2, 100)
                i += 1
            return s
    
        tmpfilename = str(udir.join('test_rvmprof'))
    
        def f(num):
            rthread.get_ident() # register TLOFS_thread_ident
            code = MyCode("py:x:foo:3")
            rvmprof.register_code(code, get_name)
            fd = os.open(tmpfilename, os.O_WRONLY | os.O_CREAT, 0666)
            period = 0.0001
            rvmprof.enable(fd, period)
            res = main(code, num)
            #assert res == 499999500000
            rvmprof.disable()
            os.close(fd)
            return 0
    
        def check_vmprof_output():
            from vmprof import read_profile
            tmpfile = str(udir.join('test_rvmprof'))
            stats = read_profile(tmpfile)
            t = stats.get_tree()
            assert t.name == 'py:x:foo:3'
            assert len(t.children) == 1 # jit
    
>       self.meta_interp(f, [1000000], inline=True)

jit/backend/llsupport/test/zrpy_vmprof_test.py:84: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
jit/backend/test/support.py:63: in meta_interp
    **kwds)
jit/metainterp/warmspot.py:242: in __init__
    self.build_cpu(CPUClass, **kwds)
jit/metainterp/warmspot.py:494: in build_cpu
    translate_support_code, gcdescr=self.gcdescr)
jit/backend/x86/runner.py:147: in __init__
    super(CPU386, self).__init__(*args, **kwargs)
jit/backend/x86/runner.py:43: in __init__
    translate_support_code, gcdescr)
jit/backend/llsupport/llmodel.py:58: in __init__
    self.gc_ll_descr = get_ll_description(gcdescr, translator, rtyper)
jit/backend/llsupport/gc.py:664: in get_ll_description
    return cls(gcdescr, translator, rtyper)
jit/backend/llsupport/gc.py:334: in __init__
    self._make_layoutbuilder()
jit/backend/llsupport/gc.py:373: in _make_layoutbuilder
    self.layoutbuilder = framework.TransformerLayoutBuilder(translator)
memory/gctransform/framework.py:1679: in __init__
    GCClass, _ = choose_gc_from_config(translator.config)
memory/gc/base.py:593: in choose_gc_from_config
    globals(), locals(), [classname])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    """
    # XXX Should find a way to bound the major collection threshold by the
    # XXX total addressable size.  Maybe by keeping some minimarkpage arenas
    # XXX pre-reserved, enough for a few nursery collections?  What about
    # XXX raw-malloced memory?
    
    # XXX try merging old_objects_pointing_to_pinned into
    # XXX old_objects_pointing_to_young (IRC 2014-10-22, fijal and gregor_w)
    import sys
    import os
    import time
    from rpython.rtyper.lltypesystem import lltype, llmemory, llarena, llgroup
    from rpython.rtyper.lltypesystem.lloperation import llop
    from rpython.rtyper.lltypesystem.llmemory import raw_malloc_usage
    from rpython.memory.gc.base import GCBase, MovingGCBase
>   from rpython.memory.gc import env
E     File "/build_dir/rpython-linux-x86-32/build/rpython/memory/gc/env.py", line 423
E   SyntaxError: Non-ASCII character '\xe2' in file /build_dir/rpython-linux-x86-32/build/rpython/memory/gc/env.py on line 423, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

memory/gc/incminimark.py:70: SyntaxError
---------- Captured stderr call ----------
[rtyper] specializing: 100 / 683 blocks   (14%)
[rtyper] specializing: 200 / 703 blocks   (28%)
[rtyper] specializing: 300 / 710 blocks   (42%)
[rtyper] specializing: 400 / 719 blocks   (55%)
[rtyper] specializing: 500 / 724 blocks   (69%)
[rtyper] specializing: 600 / 726 blocks   (82%)
[rtyper] specializing: 700 / 728 blocks   (96%)
[rtyper] -=- specialized 728 blocks -=-
[rtyper] -=- specialized 4 more blocks -=-
 (somefailed=True in jit/backend/x86/test/test_zrpy_vmprof.py)
builder: rpython-linux-x86-32 build #832
test: jit/backend/x86/test/test_zrpy_vmprof/py/TestZVMprof/()/test_vmprof