Пример #1
0
 def enableProfiler(interp, s_frame, w_rcvr, fileno, period):
     try:
         rvmprof.enable(fileno, period)
     except rvmprof.VMProfError as e:
         print e.msg
         raise PrimitiveFailedError
     return w_rcvr
Пример #2
0
def enableProfiler(interp, s_frame, w_rcvr, fileno, period):
    from rpython.rlib import rvmprof
    try:
        rvmprof.enable(fileno, period)
    except rvmprof.VMProfError as e:
        print e.msg
        raise PrimitiveFailedError
    return w_rcvr
Пример #3
0
    def __enter__(self):
        if not self.enabled:
            return

        self.handle = open(self.path, "wb")
        try:
            rvmprof.enable(self.handle.fileno(), 0.00042)
        except rvmprof.VMProfError as vmpe:
            print "Couldn't enable vmprof:", vmpe.msg
Пример #4
0
    def __enter__(self):
        if not self.enabled:
            return

        self.handle = open(self.path, "wb")
        try:
            rvmprof.enable(self.handle.fileno(), 0.00042)
        except rvmprof.VMProfError as vmpe:
            print "Couldn't enable vmprof:", vmpe.msg
Пример #5
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
Пример #6
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
Пример #7
0
def enable(space, fileno, period, memory, lines, native, real_time):
    """Enable vmprof.  Writes go to the given 'fileno', a file descriptor
    opened for writing.  *The file descriptor must remain open at least
    until disable() is called.*

    'interval' is a float representing the sampling interval, in seconds.
    Must be smaller than 1.0
    """
    try:
        rvmprof.enable(fileno, period, memory, native, real_time)
    except rvmprof.VMProfError as e:
        raise VMProfError(space, e)
Пример #8
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
Пример #9
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
Пример #10
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
Пример #11
0
    def __enter__(self):
        # We can only enter once, since we must register the profile handles,
        # and that is a one-time sort of thing.
        if not self.enabled:
            return

        self.handle = open(self.path, "wb")
        try:
            # Turn on vmprof, and *then* register the profile handles.
            rvmprof.enable(self.handle.fileno(), 0.00042)
            registerProfileTyphon()
        except rvmprof.VMProfError as vmpe:
            print "Couldn't enable vmprof:", vmpe.msg
Пример #12
0
    def __enter__(self):
        # We can only enter once, since we must register the profile handles,
        # and that is a one-time sort of thing.
        if not self.enabled:
            return

        self.handle = open(self.path, "wb")
        try:
            # Turn on vmprof, and *then* register the profile handles.
            rvmprof.enable(self.handle.fileno(), 0.00042)
            registerProfileTyphon()
        except rvmprof.VMProfError as vmpe:
            print "Couldn't enable vmprof:", vmpe.msg
Пример #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 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
Пример #15
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
Пример #16
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
Пример #17
0
def enable(space, fileno, period):
    """Enable vmprof.  Writes go to the given 'fileno', a file descriptor
    opened for writing.  *The file descriptor must remain open at least
    until disable() is called.*

    'interval' is a float representing the sampling interval, in seconds.
    Must be smaller than 1.0
    """
    w_modules = space.sys.get('modules')
    #if space.contains_w(w_modules, space.wrap('_continuation')):
    #    space.warn(space.wrap("Using _continuation/greenlet/stacklet together "
    #                          "with vmprof will crash"),
    #               space.w_RuntimeWarning)
    try:
        rvmprof.enable(fileno, period)
    except rvmprof.VMProfError, e:
        raise VMProfError(space, e)
Пример #18
0
def enable(space, fileno, period):
    """Enable vmprof.  Writes go to the given 'fileno', a file descriptor
    opened for writing.  *The file descriptor must remain open at least
    until disable() is called.*

    'interval' is a float representing the sampling interval, in seconds.
    Must be smaller than 1.0
    """
    w_modules = space.sys.get('modules')
    #if space.contains_w(w_modules, space.wrap('_continuation')):
    #    space.warn(space.wrap("Using _continuation/greenlet/stacklet together "
    #                          "with vmprof will crash"),
    #               space.w_RuntimeWarning)
    try:
        rvmprof.enable(fileno, period)
    except rvmprof.VMProfError as e:
        raise VMProfError(space, e)
Пример #19
0
 def func(interp, s_frame, w_rcvr):
     from rsqueakvm.plugins.profiler_plugin import vmproflogfile, jitlogfile
     if not vmproflogfile.isopen():
         vmproflogfile.open("SqueakProfile")
         try:
             rvmprof.enable(vmproflogfile.fileno(), DEFAULT_PERIOD)
         except rvmprof.VMProfError as e:
             print "Failed to start vmprof: %s" % e.msg
             vmproflogfile.close()
     if not jitlogfile.isopen():
         jitlogfile.open("SqueakProfile.jitlog")
         try:
             rjitlog.enable_jitlog(jitlogfile.fileno())
         except rjitlog.JitlogError as e:
             print "Failed to start jitlog: %s" % e.msg
             jitlogfile.close()
     return w_rcvr
Пример #20
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
Пример #21
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
Пример #22
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
Пример #23
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 not vmproflogfile.isopen():
        vmproflogfile.open("SqueakProfile")
        try:
            rvmprof.enable(vmproflogfile.fileno(), DEFAULT_PERIOD)
        except rvmprof.VMProfError as e:
            print "Failed to start vmprof: %s" % e.msg
            vmproflogfile.close()
    if not jitlogfile.isopen():
        jitlogfile.open("SqueakProfile.jitlog")
        try:
            rjitlog.enable_jitlog(jitlogfile.fileno())
        except rjitlog.JitlogError as e:
            print "Failed to start jitlog: %s" % e.msg
            jitlogfile.close()
    return w_rcvr
Пример #24
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
Пример #25
0
def enable(fileobj, interval):
    rvmprof.enable(rffi.r_long(fileobj.fd), interval.number)
    return null