Example #1
0
 def enableJitlog(interp, s_frame, w_rcvr, fileno):
     try:
         rjitlog.enable_jitlog(fileno)
     except rjitlog.JitlogError as e:
         print e.msg
         raise PrimitiveFailedError
     return w_rcvr
Example #2
0
def enableJitlog(interp, s_frame, w_rcvr, fileno):
    from rpython.rlib.rjitlog import rjitlog
    try:
        rjitlog.enable_jitlog(fileno)
    except rjitlog.JitlogError as e:
        print e.msg
        raise PrimitiveFailedError
    return w_rcvr
Example #3
0
def enableJitlog(interp, s_frame, w_rcvr, fileno):
    from rpython.rlib.rjitlog import rjitlog
    try:
        rjitlog.enable_jitlog(fileno)
    except rjitlog.JitlogError as e:
        print e.msg
        raise PrimitiveFailedError
    return w_rcvr
Example #4
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
Example #5
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
Example #6
0
    def test_explicit_enable(self, tmpdir):
        file = tmpdir.join('jitlog')
        fileno = os.open(file.strpath, os.O_WRONLY | os.O_CREAT)
        enable_jitlog = lambda: rjitlog.enable_jitlog(fileno)
        f = self.run_sample_loop(enable_jitlog)
        self.meta_interp(f, [10, 0])

        assert os.path.exists(file.strpath)
        with file.open('rb') as f:
            # check the file header
            assert f.read(3) == jl.MARK_JITLOG_HEADER + jl.JITLOG_VERSION_16BIT_LE
            assert len(f.read()) > 0
Example #7
0
    def test_explicit_enable(self, tmpdir):
        file = tmpdir.join('jitlog')
        fileno = os.open(file.strpath, os.O_WRONLY | os.O_CREAT)
        enable_jitlog = lambda: rjitlog.enable_jitlog(fileno)
        f = self.run_sample_loop(enable_jitlog)
        self.meta_interp(f, [10, 0])

        assert os.path.exists(file.strpath)
        with file.open('rb') as f:
            # check the file header
            assert f.read(3) == jl.MARK_JITLOG_HEADER + jl.JITLOG_VERSION_16BIT_LE
            assert len(f.read()) > 0
Example #8
0
    def test_explicit_enable(self, tmpdir):
        file = tmpdir.join('jitlog')
        # use rfile instead of file.open since the host python and compiled
        # code may use different runtime libraries (win32 visual2008 vs.
        # visual2019 for instance
        rfile = create_file(file.strpath, 'wb')
        fileno = rfile.fileno()
        with FdValidator(fileno):
            enable_jitlog = lambda: rjitlog.enable_jitlog(fileno)
            f = self.run_sample_loop(enable_jitlog)
            self.meta_interp(f, [10, 0])
            # meta_interp calls jitlog.finish which closes the file descriptor
            # rfile.close()

        assert os.path.exists(file.strpath)
        with file.open('rb') as f:
            # check the file header
            assert f.read(
                3) == jl.MARK_JITLOG_HEADER + jl.JITLOG_VERSION_16BIT_LE
            assert len(f.read()) > 0
Example #9
0
def enable(space, fileno):
    """ Enable PyPy's logging facility. """
    try:
        rjitlog.enable_jitlog(fileno)
    except rjitlog.JitlogError, e:
        raise JitlogError(space, e)
Example #10
0
def enable(fileobj):
    try:
        rjitlog.enable_jitlog(rffi.r_long(fileobj.fd))
    except rjitlog.JitlogError as error:
        raise unwind(LError(error.msg.decode('utf-8')))
    return null
Example #11
0
def enable(space, fileno):
    """ Enable PyPy's logging facility. """
    try:
        rjitlog.enable_jitlog(fileno)
    except rjitlog.JitlogError, e:
        raise JitlogError(space, e)