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
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
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
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
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)
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 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
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
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
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
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
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)
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)
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
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
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
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
def enable(fileobj, interval): rvmprof.enable(rffi.r_long(fileobj.fd), interval.number) return null