Пример #1
0
def getMySources(filename):
    extra_path = os.path.dirname(filename)
    storage = LoopStorage(extra_path)

    log, loops = import_log(filename, ParserWithHtmlRepr)
    parse_log_counts(extract_category(log, "jit-backend-count"), loops)
    storage.loops = [loop for loop in loops if not loop.descr.startswith("bridge")]
    [l.force_asm() for l in storage.loops]
    storage.loop_dict = create_loop_dict(loops)
    loops = index(storage)
    ids = [item.descr for item in loops]

    mySources = []
    for item in ids:
        source, name, up, filename, startline, callstack = loopfunc(item, storage)
        i = 1
        mySource = []
        pending = False
        pendingLine = 0
        pendingCode = ""
        for sourceline in source.lines:
            # print  str(i) + ": " + sourceline.line
            line = sourceline.line
            chunks = []
            if sourceline.in_loop and line.strip != "":
                if sourceline.chunks:
                    makePending = True
                    for chunk in sourceline.chunks:
                        if chunk.is_bytecode:
                            ops = []
                            for op in chunk.operations:
                                if op.name != "debug_merge_point":
                                    op_repr = (op.html_repr(), op.asm)
                                    ops.append(op_repr)
                            chunks.append((chunk.html_repr(), chunk, ops))

            if len(chunks) == 0:
                if pending:
                    pendingCode += "\n" + line
                else:
                    pendingCode = line
                    pendingLine = i
                    pending = True
            else:
                if pending:
                    pending = False
                    mySource.append((pendingLine, pendingCode, None))
                mySource.append((i, line, chunks))
            i += 1
        if pending:
            pending = False
            mySource.append((pendingLine, pendingCode, None))
        mySources.append((filename, mySource))

    return mySources
Пример #2
0
def main():
    filename = sys.argv[1]
    extra_path = os.path.dirname(filename)
    storage = LoopStorage(extra_path)
    
    log, loops = import_log(filename, ParserWithHtmlRepr)
    parse_log_counts(extract_category(log, 'jit-backend-count'), loops)
    storage.loops = [loop for loop in loops
                     if not loop.descr.startswith('bridge')]
    storage.loop_dict = create_loop_dict(loops)
    print loops,log,storage
    server = Server(filename, storage)
Пример #3
0
def main():
    if not '__pypy__' in sys.builtin_module_names:
        print "Please run it using pypy-c"
        sys.exit(1)
    #
    server_mode = True
    if '--qt' in sys.argv:
        server_mode = False
        sys.argv.remove('--qt')
    #
    if len(sys.argv) != 2 and len(sys.argv) != 3:
        print __doc__
        sys.exit(1)
    filename = sys.argv[1]
    extra_path = os.path.dirname(filename)
    if len(sys.argv) != 3:
        port = 5000
    else:
        port = int(sys.argv[2])
    storage = LoopStorage(extra_path)
    log, loops = import_log(filename, ParserWithHtmlRepr)
    parse_log_counts(extract_category(log, 'jit-backend-count'), loops)
    storage.loops = [loop for loop in loops
                     if not loop.descr.startswith('bridge')]
    storage.loop_dict = create_loop_dict(loops)
    print loops,log,storage
    app = OverrideFlask('_jitviewer')
    server = Server(filename, storage)
    app.debug = True
    app.route('/')(server.index)
    app.route('/loop')(server.loop)
    def run():
        app.run(use_reloader=False, host='0.0.0.0', port=port)

    if server_mode:
        run()
    else:
        url = "http://localhost:%d/" % port
        run_server_and_browser(app, run, url, filename)