示例#1
0
 def disableProfiler(interp, s_frame, w_rcvr):
     try:
         rvmprof.disable()
     except rvmprof.VMProfError as e:
         print e.msg
         raise PrimitiveFailedError
     return w_rcvr
示例#2
0
def disable(space):
    """Disable vmprof.  Remember to close the file descriptor afterwards
    if necessary.
    """
    try:
        rvmprof.disable()
    except rvmprof.VMProfError, e:
        raise VMProfError(space, e)
示例#3
0
def disable(space):
    """Disable vmprof.  Remember to close the file descriptor afterwards
    if necessary.
    """
    try:
        rvmprof.disable()
    except rvmprof.VMProfError as e:
        raise VMProfError(space, e)
示例#4
0
def disableProfiler(interp, s_frame, w_rcvr):
    from rpython.rlib import rvmprof
    try:
        rvmprof.disable()
    except rvmprof.VMProfError as e:
        print e.msg
        raise PrimitiveFailedError
    return w_rcvr
示例#5
0
    def __exit__(self, *args):
        if not self.enabled:
            return

        try:
            rvmprof.disable()
        except rvmprof.VMProfError as vmpe:
            print "Couldn't disable vmprof:", vmpe.msg
        self.handle.close()
示例#6
0
    def __exit__(self, *args):
        if not self.enabled:
            return

        try:
            rvmprof.disable()
        except rvmprof.VMProfError as vmpe:
            print "Couldn't disable vmprof:", vmpe.msg
        self.handle.close()
示例#7
0
 def f():
     code = MyCode()
     rvmprof.register_code(code, get_name)
     fd = os.open(tmpfilename, os.O_WRONLY | os.O_CREAT, 0666)
     rvmprof.enable(fd, 0.5)
     res = main(code, 5)
     assert res == 42
     rvmprof.disable()
     os.close(fd)
     return 0
示例#8
0
 def f():
     code = MyCode()
     rvmprof.register_code(code, get_name)
     fd = os.open(tmpfilename, os.O_WRONLY | os.O_CREAT, 0666)
     rvmprof.enable(fd, 0.5)
     res = main(code, 5)
     assert res == 42
     rvmprof.disable()
     os.close(fd)
     return 0
示例#9
0
 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
示例#10
0
 def entry_point(self, value, delta_t):
     code = self.MyCode('py:code:52:test_enable')
     rvmprof.register_code(code, self.MyCode.get_name)
     fd = os.open(self.tmpfilename, os.O_WRONLY | os.O_CREAT, 0666)
     rvmprof.enable(fd, self.SAMPLING_INTERVAL)
     start = time.time()
     res = 0
     while time.time() < start + delta_t:
         res = self.main(code, value)
     rvmprof.disable()
     os.close(fd)
     return res
示例#11
0
 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
示例#12
0
 def func(interp, s_frame, w_rcvr):
     from rsqueakvm.plugins.profiler_plugin import vmproflogfile, jitlogfile
     if vmproflogfile.isopen():
         try:
             rvmprof.disable()
         except rvmprof.VMProfError as e:
             print "Failure disabling vmprof: %s" % e.msg
     if jitlogfile.isopen():
         rjitlog.disable_jitlog()
     vmproflogfile.close()
     jitlogfile.close()
     return w_rcvr
示例#13
0
def main(argv=[]):
    code1 = MyCode(6500)
    fd = os.open(PROF_FILE, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0666)
    rvmprof.enable(fd, 0.01)
    #
    code2 = MyCode(9100)
    stop = time.time() + 1
    while time.time() < stop:
        interpret(code1)
        interpret(code2)
    #
    rvmprof.disable()
    os.close(fd)
    return 0
示例#14
0
def func(interp, s_frame, w_rcvr):
    from rpython.rlib.rjitlog import rjitlog
    from rpython.rlib import rvmprof
    from rsqueakvm.plugins.profiler_plugin import vmproflogfile, jitlogfile
    if vmproflogfile.isopen():
        try:
            rvmprof.disable()
        except rvmprof.VMProfError as e:
            print "Failure disabling vmprof: %s" % e.msg
    if jitlogfile.isopen():
        rjitlog.disable_jitlog()
    vmproflogfile.close()
    jitlogfile.close()
    return w_rcvr
示例#15
0
def main(argv=[]):
    code1 = MyCode(6500)
    fd = os.open(PROF_FILE, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0666)
    rvmprof.enable(fd, 0.01)
    #
    code2 = MyCode(9100)
    stop = time.time() + 1
    while time.time() < stop:
        interpret(code1)
        interpret(code2)
    #
    rvmprof.disable()
    os.close(fd)
    return 0
示例#16
0
 def f():
     if NonConstant(False):
         # Hack to give os.open() the correct annotation
         os.open('foo', 1, 1)
     code = MyCode()
     rvmprof.register_code(code, get_name)
     fd = os.open(tmpfilename, os.O_RDWR | os.O_CREAT, 0666)
     num = 10000
     period = 0.0001
     rvmprof.enable(fd, period, native=1)
     for i in range(num):
         res = main(code, 3)
     rvmprof.disable()
     os.close(fd)
     return 0
示例#17
0
 def f():
     code = MyCode()
     rvmprof.register_code(code, get_name)
     fd = os.open(tmpfilename, os.O_WRONLY | os.O_CREAT, 0666)
     if we_are_translated():
         num = 100000000
         period = 0.0001
     else:
         num = 10000
         period = 0.9
     rvmprof.enable(fd, period)
     res = main(code, num)
     #assert res == 499999500000
     rvmprof.disable()
     os.close(fd)
     return 0
示例#18
0
def main(argv=[]):
    rthread.get_ident()  # force TLOFS_thread_ident
    if NonConstant(False):
        # Hack to give os.open() the correct annotation
        os.open('foo', 1, 1)
    code1 = MyCode(6500)
    fd = os.open(PROF_FILE, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0666)
    rvmprof.enable(fd, 0.01)
    #
    code2 = MyCode(9100)
    stop = time.time() + 1
    while time.time() < stop:
        interpret(code1)
        interpret(code2)
    #
    rvmprof.disable()
    os.close(fd)
    return 0
示例#19
0
def main(argv=[]):
    rthread.get_ident() # force TLOFS_thread_ident
    if NonConstant(False):
        # Hack to give os.open() the correct annotation
        os.open('foo', 1, 1)
    code1 = MyCode(6500)
    fd = os.open(PROF_FILE, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0666)
    rvmprof.enable(fd, 0.01)
    #
    code2 = MyCode(9100)
    stop = time.time() + 1
    while time.time() < stop:
        interpret(code1)
        interpret(code2)
    #
    rvmprof.disable()
    os.close(fd)
    return 0
示例#20
0
 def f():
     if NonConstant(False):
         # Hack to give os.open() the correct annotation
         os.open('foo', 1, 1)
     code = MyCode()
     rvmprof.register_code(code, get_name)
     fd = os.open(tmpfilename, os.O_WRONLY | os.O_CREAT, 0666)
     if we_are_translated():
         num = 100000000
         period = 0.0001
     else:
         num = 10000
         period = 0.9
     rvmprof.enable(fd, period)
     res = main(code, num)
     #assert res == 499999500000
     rvmprof.disable()
     os.close(fd)
     return 0
示例#21
0
 def f():
     if NonConstant(False):
         # Hack to give os.open() the correct annotation
         os.open('foo', 1, 1)
     code = MyCode()
     rvmprof.register_code(code, get_name)
     fd = os.open(tmpfilename, os.O_WRONLY | os.O_CREAT, 0666)
     if we_are_translated():
         num = 100000000
         period = 0.0001
     else:
         num = 10000
         period = 0.9
     rvmprof.enable(fd, period)
     res = main(code, num)
     #assert res == 499999500000
     rvmprof.disable()
     os.close(fd)
     return 0
示例#22
0
def disable():
    rvmprof.disable()
    return null