Commits

Maciej Fijalkowski committed 1e2a0ea

display statistics for bridges

Comments (0)

Files changed (8)

 import inspect
 from pypy.tool.logparser import parse_log_file, extract_category
 from module_finder import load_code
-from loops import parse, slice_debug_merge_points, adjust_bridges
+from loops import (parse, slice_debug_merge_points, adjust_bridges,
+                   parse_log_counts)
 from storage import LoopStorage
 from display import CodeRepr, CodeReprNoFile
 
 
     def index(self):
         loops = []
-        for loop in self.storage.loops:
+        for index, loop in enumerate(self.storage.loops):
             if 'entry bridge' in loop.comment:
                 is_entry = True
             else:
                 is_entry = False
-            loops.append((is_entry, slice_debug_merge_points(loop.operations)))
+            func = slice_debug_merge_points(loop.operations)
+            func.count = loop.count
+            loops.append((is_entry, index, func))
+        loops.sort(lambda a, b: cmp(b[2].count, a[2].count))
         return flask.render_template('index.html', loops=loops)
 
     def loop(self):
-        no = int(flask.request.args.get('no', '1'))
-        orig_loop = self.storage.loops[no - 1]
+        no = int(flask.request.args.get('no', '0'))
+        orig_loop = self.storage.loops[no]
         ops = adjust_bridges(orig_loop, flask.request.args)
         loop = slice_debug_merge_points(ops)
         path = flask.request.args.get('path', '').split(',')
                                            current_loop=no,
                                            upper_path=up,
                                            show_upper_path=bool(path)),
-             'scrollto': startline}
+             'scrollto': startline,
+             'callstack': None}
         return flask.jsonify(d)
 
 def main():
-[33541c9c6843] {jit-log-opt-loop
+[88054ec0026] {jit-log-opt-loop
 # Loop 0 : loop with 21 ops
 [p0, p1, p2, p3, i4, p5, p6, i7]
 debug_merge_point('<code object f, file 'source.py', line 4> #9 LOAD_FAST')
 guard_false(i19, descr=<Guard3>) [p1, p0, p2, p3, i11, None]
 debug_merge_point('<code object f, file 'source.py', line 4> #9 LOAD_FAST')
 jump(p0, p1, p2, p3, 9, ConstPtr(ptr22), ConstPtr(ptr23), i11, descr=<Loop0>)
-[33541ca2d845] jit-log-opt-loop}
-[33541ccf77af] {jit-log-opt-loop
+[88054f4890a] jit-log-opt-loop}
+[880552c5bde] {jit-log-opt-loop
 # Loop 1 : loop with 60 ops
 [p0, p1, p2, p3, i4, p5, p6, p7]
 debug_merge_point('<code object inlined_call, file 'source.py', line 14> #9 LOAD_FAST')
 p49 = new_with_vtable(ConstClass(W_IntObject))
 setfield_gc(p49, i37, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>)
 jump(p0, p1, p2, p3, 9, ConstPtr(ptr51), ConstPtr(ptr52), p49, descr=<Loop1>)
-[33541cd3ebcf] jit-log-opt-loop}
-[33541d2bb45f] {jit-log-opt-loop
+[8805532e58a] jit-log-opt-loop}
+[88055a4b936] {jit-log-opt-loop
 # Loop 2 : loop with 43 ops
 [p0, p1, p2, p3, i4, p5, p6, i7, i8]
 debug_merge_point('<code object bridge, file 'source.py', line 21> #15 LOAD_FAST')
 debug_merge_point('<code object bridge, file 'source.py', line 21> #18 LOAD_CONST')
 debug_merge_point('<code object bridge, file 'source.py', line 21> #21 COMPARE_OP')
-i10 = int_lt(i8, 3000)
+i10 = int_lt(i8, 10000)
 guard_true(i10, descr=<Guard17>) [p1, p0, p2, p3, i8, i7]
 debug_merge_point('<code object bridge, file 'source.py', line 21> #24 JUMP_IF_FALSE')
 debug_merge_point('<code object bridge, file 'source.py', line 21> #27 POP_TOP')
 guard_false(i36, descr=<Guard20>) [p1, p0, p2, p3, i25, i28, None, None, None]
 debug_merge_point('<code object bridge, file 'source.py', line 21> #15 LOAD_FAST')
 jump(p0, p1, p2, p3, 15, ConstPtr(ptr38), ConstPtr(ptr39), i25, i28, descr=<Loop2>)
-[33541d2e45a1] jit-log-opt-loop}
-[33541d5ed673] {jit-log-opt-loop
+[88055a88246] jit-log-opt-loop}
+[88055c86262] {jit-log-opt-loop
 # Loop 3 : entry bridge with 50 ops
 [p0, p1, p2, p3, i4, p5, i6, p7, p8, p9, p10]
 debug_merge_point('<code object bridge, file 'source.py', line 21> #15 LOAD_FAST')
 guard_value(p2, ConstPtr(ptr13), descr=<Guard23>) [p1, p0, p2, p3, p5, p10, p8, p9]
 debug_merge_point('<code object bridge, file 'source.py', line 21> #21 COMPARE_OP')
 i14 = getfield_gc_pure(p10, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>)
-i16 = int_lt(i14, 3000)
+i16 = int_lt(i14, 10000)
 guard_true(i16, descr=<Guard24>) [p1, p0, p10, p3, p5, p9]
 debug_merge_point('<code object bridge, file 'source.py', line 21> #24 JUMP_IF_FALSE')
 debug_merge_point('<code object bridge, file 'source.py', line 21> #27 POP_TOP')
 guard_false(i44, descr=<Guard28>) [p1, p0, p3, p5, i36, i34, None]
 debug_merge_point('<code object bridge, file 'source.py', line 21> #15 LOAD_FAST')
 jump(p0, p1, p3, p5, 15, ConstPtr(ptr46), ConstPtr(ptr47), i34, i36, descr=<Loop2>)
-[33541d616773] jit-log-opt-loop}
-[33541d83d463] {jit-log-opt-bridge
+[88055cbcaa6] jit-log-opt-loop}
+[88055f9491a] {jit-log-opt-bridge
 # bridge out of Guard 18 with 23 ops
 [p0, p1, p2, p3, i4, i5, i6]
 debug_merge_point('<code object bridge, file 'source.py', line 21> #38 POP_TOP')
 guard_false(i19, descr=<Guard31>) [p0, p1, p2, p3, i10, i8, None, None]
 debug_merge_point('<code object bridge, file 'source.py', line 21> #15 LOAD_FAST')
 jump(p1, p0, p2, p3, 15, ConstPtr(ptr21), ConstPtr(ptr22), i8, i10, descr=<Loop2>)
-[33541d855759] jit-log-opt-bridge}
-[33541da64d0f] {jit-log-opt-loop
+[88055fada36] jit-log-opt-bridge}
+[88056292fda] {jit-log-opt-loop
 # Loop 4 : loop with 54 ops
 [p0, p1, p2, p3, i4, p5, p6, p7, p8, p9, p10, p11, p12, i13, p14, p15]
 debug_merge_point('<code object inlined_str_stuff, file 'source.py', line 34> #17 FOR_ITER')
 guard_false(i59, descr=<Guard45>) [p1, p0, p2, p3, p5, p6, p10, p11, p12, p14, p15, i25]
 debug_merge_point('<code object inlined_str_stuff, file 'source.py', line 34> #17 FOR_ITER')
 jump(p0, p1, p2, p3, 17, p5, p6, ConstPtr(ptr61), ConstPtr(ptr62), ConstPtr(ptr63), p10, p11, p12, i25, p14, p15, descr=<Loop4>)
-[33541daa8dcb] jit-log-opt-loop}
-[33541de6847f] {jit-log-opt-loop
+[880562f0e1e] jit-log-opt-loop}
+[88056835aca] {jit-log-opt-loop
 # Loop 5 : entry bridge with 10 ops
 [i0, p1]
 debug_merge_point('StrLiteralSearch at 11/51 [17, 8, 3, 1, 1, 1, 1, 51, 0, 19, 51, 1]')
 i9 = int_lt(i7, i8)
 guard_false(i9, descr=<Guard47>) [i7, p1]
 finish(0, descr=<DoneWithThisFrameDescrInt object at 0x898b4a4>)
-[33541de75535] jit-log-opt-loop}
-[33541df9f0a1] {jit-log-opt-bridge
+[88056847d86] jit-log-opt-loop}
+[880569e8a52] {jit-log-opt-bridge
 # bridge out of Guard 47 with 10 ops
 [i0, p1]
 debug_merge_point('StrLiteralSearch at 11/51 [17, 8, 3, 1, 1, 1, 1, 51, 0, 19, 51, 1]')
 i9 = int_lt(i7, i8)
 guard_false(i9, descr=<Guard49>) [i7, p1]
 finish(0, descr=<DoneWithThisFrameDescrInt object at 0x898b4a4>)
-[33541dfb0d7b] jit-log-opt-bridge}
-[33541e1a7a37] {jit-log-opt-bridge
+[88056a002b2] jit-log-opt-bridge}
+[88056cd128a] {jit-log-opt-bridge
 # bridge out of Guard 49 with 10 ops
 [i0, p1]
 debug_merge_point('StrLiteralSearch at 11/51 [17, 8, 3, 1, 1, 1, 1, 51, 0, 19, 51, 1]')
 i9 = int_lt(i7, i8)
 guard_false(i9, descr=<Guard51>) [i7, p1]
 finish(0, descr=<DoneWithThisFrameDescrInt object at 0x898b4a4>)
-[33541e1b1199] jit-log-opt-bridge}
-[33541ede5f61] {jit-log-opt-loop
+[88056cddf32] jit-log-opt-bridge}
+[88057b646ce] {jit-log-opt-loop
 # Loop 6 : loop with 252 ops
 [p0, p1, p2, p3, i4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15]
 debug_merge_point('<code object inlined_str_stuff, file 'source.py', line 34> #52 FOR_ITER')
 setarrayitem_gc(p92, 0, ConstPtr(ptr94), descr=<GcPtrArrayDescr>)
 setarrayitem_gc(p92, 1, p49, descr=<GcPtrArrayDescr>)
 p98 = call(ConstClass(ll_getitem__dum_checkidxConst_arrayPtr_Signed), p92, 0, descr=<GcPtrCallDescr>)
-guard_no_exception(, descr=<Guard83>) [p1, p0, p52, p98, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, i79, p89, p49, p68, p92, i60, p59]
+guard_no_exception(, descr=<Guard83>) [p1, p0, p52, p98, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, i60, p89, p49, i79, p59, p68, p92]
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #10 CALL_FUNCTION')
-guard_class(p98, ConstClass(W_StringObject), descr=<Guard84>) [p1, p0, p52, p98, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, i79, None, p49, p68, p92, i60, p59]
+guard_class(p98, ConstClass(W_StringObject), descr=<Guard84>) [p1, p0, p52, p98, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, i60, None, p49, i79, p59, p68, p92]
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #13 BUILD_TUPLE')
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #16 LOAD_FAST')
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #19 BINARY_ADD')
 i100 = arraylen_gc(p92, descr=<GcPtrArrayDescr>)
 i102 = int_add_ovf(1, i100)
-guard_no_overflow(, descr=<Guard85>) [p1, p0, p52, i102, i100, p92, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, i79, None, p49, p68, None, i60, p59]
+guard_no_overflow(, descr=<Guard85>) [p1, p0, p52, i102, i100, p92, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, i60, None, p49, i79, p59, p68, None]
 p103 = new_array(i102, descr=<GcPtrArrayDescr>)
 p105 = new_array(1, descr=<GcPtrArrayDescr>)
 setarrayitem_gc(p105, 0, ConstPtr(ptr107), descr=<GcPtrArrayDescr>)
 call(ConstClass(ll_arraycopy__arrayPtr_arrayPtr_Signed_Signed_Signed), p105, p103, 0, 0, 1, descr=<VoidCallDescr>)
-guard_no_exception(, descr=<Guard86>) [p1, p0, p52, i100, p103, p92, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, i79, p105, p68, i60, p59]
+guard_no_exception(, descr=<Guard86>) [p1, p0, p52, i100, p103, p92, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, i60, p49, i79, p59, p105, p68]
 call(ConstClass(ll_arraycopy__arrayPtr_arrayPtr_Signed_Signed_Signed), p92, p103, 0, 1, i100, descr=<VoidCallDescr>)
-guard_no_exception(, descr=<Guard87>) [p1, p0, p52, p103, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p92, p49, i79, p105, p68, i60, p59]
+guard_no_exception(, descr=<Guard87>) [p1, p0, p52, p103, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p92, i60, p49, i79, p59, p105, p68]
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #20 STORE_FAST')
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #23 LOAD_GLOBAL')
 p112 = getfield_gc(ConstPtr(ptr111), descr=<GcPtrFieldDescr pypy.objspace.std.celldict.ModuleCell.inst_w_value 8>)
-guard_nonnull_class(p112, 144126432, descr=<Guard88>) [p1, p0, p52, p112, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p103, p92, p49, i79, None, p68, i60, p59]
+guard_nonnull_class(p112, 144126432, descr=<Guard88>) [p1, p0, p52, p112, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p103, p92, i60, p49, i79, p59, None, p68]
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #26 LOOKUP_METHOD')
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #29 LOAD_FAST')
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #32 CALL_METHOD')
 i117 = arraylen_gc(p116, descr=<GcPtrArrayDescr>)
 i119 = int_sub(3, i117)
 i121 = int_ge(2, i119)
-guard_true(i121, descr=<Guard89>) [p1, p0, p52, p115, i119, p116, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p112, p103, p92, p49, i79, None, p68, i60, p59]
+guard_true(i121, descr=<Guard89>) [p1, p0, p52, p115, i119, p116, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p112, p103, p92, i60, p49, i79, p59, None, p68]
 i122 = int_sub(2, i119)
 p123 = getarrayitem_gc(p116, i122, descr=<GcPtrArrayDescr>)
-guard_class(p123, ConstClass(W_NoneObject), descr=<Guard90>) [p1, p0, p52, p123, p112, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, None, p103, p92, p49, i79, None, p68, i60, p59]
+guard_class(p123, ConstClass(W_NoneObject), descr=<Guard90>) [p1, p0, p52, p123, p112, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, None, p103, p92, i60, p49, i79, p59, None, p68]
 p125 = getfield_gc(p112, descr=<GcPtrFieldDescr pypy.objspace.std.dictmultiobject.W_DictMultiObject.inst_r_dict_content 8>)
-guard_nonnull(p125, descr=<Guard91>) [p1, p0, p52, p123, p112, p125, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, None, p103, p92, p49, i79, None, p68, i60, p59]
+guard_nonnull(p125, descr=<Guard91>) [p1, p0, p52, p123, p112, p125, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, None, p103, p92, i60, p49, i79, p59, None, p68]
 i126 = force_token()
 p128 = new_with_vtable(144079912)
 setfield_gc(p128, i79, descr=<SignedFieldDescr JitVirtualRef.virtual_token 8>)
 p131 = new_with_vtable(143831552)
 setfield_gc(p131, p103, descr=<GcPtrFieldDescr pypy.objspace.std.tupleobject.W_TupleObject.inst_wrappeditems 8>)
 p134 = call_may_force(ConstClass(ll_get__dicttablePtr_pypy_interpreter_baseobjspace_W_RootPtr_pypy_interpreter_baseobjspace_W_RootPtr), p125, p131, ConstPtr(ptr133), descr=<GcPtrCallDescr>)
-guard_not_forced(, descr=<Guard92>) [p1, p0, p52, p123, p131, p112, p134, p128, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, p68, p92, i60, p59]
-guard_no_exception(, descr=<Guard93>) [p1, p0, p52, p123, p131, p112, p134, p128, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, p68, p92, i60, p59]
-guard_nonnull_class(p134, 145393696, descr=<Guard94>) [p1, p0, p52, p123, p131, p112, p134, p128, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, p68, p92, i60, p59]
+guard_not_forced(, descr=<Guard92>) [p1, p0, p52, p123, p131, p112, p134, p128, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, i60, p59, p68, p49, p92]
+guard_no_exception(, descr=<Guard93>) [p1, p0, p52, p123, p131, p112, p134, p128, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, i60, p59, p68, p49, p92]
+guard_nonnull_class(p134, 145393696, descr=<Guard94>) [p1, p0, p52, p123, p131, p112, p134, p128, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, i60, p59, p68, p49, p92]
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #35 STORE_FAST')
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #38 LOAD_FAST')
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #41 LOAD_CONST')
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #44 COMPARE_OP')
 i137 = ptr_eq(p134, ConstPtr(ptr136))
-guard_false(i137, descr=<Guard95>) [p1, p0, p52, p128, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p131, p134, p49, p68, p92, i60, p59]
+guard_false(i137, descr=<Guard95>) [p1, p0, p52, p128, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p134, p131, i60, p59, p68, p49, p92]
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #47 JUMP_IF_FALSE')
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #50 POP_TOP')
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #51 LOAD_FAST')
 debug_merge_point('<code object _compile, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 227> #54 RETURN_VALUE')
 p138 = getfield_gc(p52, descr=<GcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_w_tracefunc 40>)
-guard_isnull(p138, descr=<Guard96>) [p1, p0, p52, p134, p138, p128, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p131, None, p49, p68, p92, i60, p59]
+guard_isnull(p138, descr=<Guard96>) [p1, p0, p52, p134, p138, p128, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, None, p131, i60, p59, p68, p49, p92]
 i139 = getfield_gc(p52, descr=<NonGcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_profilefunc 24>)
 i140 = int_is_true(i139)
-guard_false(i140, descr=<Guard97>) [p1, p0, p52, p134, p128, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p131, None, p49, p68, p92, i60, p59]
+guard_false(i140, descr=<Guard97>) [p1, p0, p52, p134, p128, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, None, p131, i60, p59, p68, p49, p92]
 i141 = getfield_gc(p52, descr=<SignedFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_framestackdepth 16>)
 i143 = int_sub(i141, 1)
 debug_merge_point('<code object search, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 139> #12 LOOKUP_METHOD')
 setfield_gc(p52, i143, descr=<SignedFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_framestackdepth 16>)
 setfield_gc(p128, -3, descr=<SignedFieldDescr JitVirtualRef.virtual_token 8>)
 i152 = int_ge(2, i149)
-guard_true(i152, descr=<Guard98>) [p1, p0, p52, p145, i149, p146, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p128, p131, p134, p49, None, p92, i60, p59]
+guard_true(i152, descr=<Guard98>) [p1, p0, p52, p145, i149, p146, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p128, p134, p131, i60, p59, None, p49, p92]
 i153 = int_sub(2, i149)
 p154 = getarrayitem_gc(p146, i153, descr=<GcPtrArrayDescr>)
 i156 = int_sub(3, i149)
 p157 = getarrayitem_gc(p146, i156, descr=<GcPtrArrayDescr>)
-guard_class(p154, ConstClass(W_IntObject), descr=<Guard99>) [p1, p0, p52, p154, p20, p134, p2, p3, p5, p33, p10, p11, p12, p13, p14, p157, p128, p131, None, p49, None, p92, i60, p59]
+guard_class(p154, ConstClass(W_IntObject), descr=<Guard99>) [p1, p0, p52, p154, p20, p134, p2, p3, p5, p33, p10, p11, p12, p13, p14, p157, p128, None, p131, i60, p59, None, p49, p92]
 i159 = getfield_gc_pure(p154, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>)
-guard_class(p157, ConstClass(W_IntObject), descr=<Guard100>) [p1, p0, p52, i159, p20, p157, p134, p2, p3, p5, p33, p10, p11, p12, p13, p14, p154, None, p128, p131, None, p49, None, p92, i60, p59]
+guard_class(p157, ConstClass(W_IntObject), descr=<Guard100>) [p1, p0, p52, i159, p20, p157, p134, p2, p3, p5, p33, p10, p11, p12, p13, p14, p154, None, p128, None, p131, i60, p59, None, p49, p92]
 i161 = getfield_gc_pure(p157, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>)
 i162 = force_token()
 p163 = new_with_vtable(144079912)
 setfield_gc(p128, p165, descr=<GcPtrFieldDescr JitVirtualRef.forced 16>)
 setfield_gc(p0, i162, descr=<SignedFieldDescr pypy.interpreter.pyframe.PyFrame.vable_token 16>)
 p182 = call_may_force(ConstClass(W_SRE_Pattern.search_w), p134, p20, i159, i161, descr=<GcPtrCallDescr>)
-guard_not_forced(, descr=<Guard101>) [p1, p0, p52, p182, p163, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, p157, p134, p154, p59]
-guard_no_exception(, descr=<Guard102>) [p1, p0, p52, p182, p163, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, p157, p134, p154, p59]
-guard_nonnull(p182, descr=<Guard103>) [p1, p0, p52, p182, p163, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, None, p134, None, p59]
+guard_not_forced(, descr=<Guard101>) [p1, p0, p52, p182, p163, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, p59, p157, p134, p154]
+guard_no_exception(, descr=<Guard102>) [p1, p0, p52, p182, p163, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, p59, p157, p134, p154]
+guard_nonnull(p182, descr=<Guard103>) [p1, p0, p52, p182, p163, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, p59, None, p134, None]
 debug_merge_point('<code object search, file '/home/fijal/src/pypy-trunk/lib-python/2.5.2/re.py', line 139> #21 RETURN_VALUE')
 p183 = getfield_gc(p52, descr=<GcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_w_tracefunc 40>)
-guard_isnull(p183, descr=<Guard104>) [p1, p0, p52, p182, p183, p163, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, None, None, None, p59]
+guard_isnull(p183, descr=<Guard104>) [p1, p0, p52, p182, p183, p163, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, p59, None, None, None]
 i184 = getfield_gc(p52, descr=<NonGcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_profilefunc 24>)
 i185 = int_is_true(i184)
-guard_false(i185, descr=<Guard105>) [p1, p0, p182, p52, p163, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, None, None, None, p59]
+guard_false(i185, descr=<Guard105>) [p1, p0, p182, p52, p163, p2, p3, p5, p33, p20, p10, p11, p12, p13, p14, p49, p59, None, None, None]
 i186 = getfield_gc(p52, descr=<SignedFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_framestackdepth 16>)
 i188 = int_sub(i186, 1)
 debug_merge_point('<code object inlined_str_stuff, file 'source.py', line 34> #73 POP_TOP')
 setfield_gc(p52, i188, descr=<SignedFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_framestackdepth 16>)
 setfield_gc(p163, -3, descr=<SignedFieldDescr JitVirtualRef.virtual_token 8>)
 i197 = int_is_true(i195)
-guard_false(i197, descr=<Guard106>) [p1, p0, p2, p3, p5, p10, p11, p12, p13, p14, p20, p163, p49, None, None, None, p59]
+guard_false(i197, descr=<Guard106>) [p1, p0, p2, p3, p5, p10, p11, p12, p13, p14, p20, p163, p49, p59, None, None, None]
 debug_merge_point('<code object inlined_str_stuff, file 'source.py', line 34> #52 FOR_ITER')
 p199 = new_with_vtable(144116512)
 setfield_gc(p199, -1, descr=<SignedFieldDescr pypy.interpreter.pyframe.PyFrame.inst_instr_ub 52>)
 setfield_gc(p199, p59, descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_f_backref 32>)
 setfield_gc(p163, p199, descr=<GcPtrFieldDescr JitVirtualRef.forced 16>)
 jump(p0, p1, p2, p3, 52, p5, ConstPtr(ptr213), ConstPtr(ptr214), ConstPtr(ptr215), ConstPtr(ptr216), p10, p11, p12, p13, p14, p20, descr=<Loop6>)
-[33541ef2225a] jit-log-opt-loop}
-[33541f1e366e] {jit-log-opt-bridge
+[88057ce3602] jit-log-opt-loop}
+[88058029122] {jit-log-opt-bridge
 # bridge out of Guard 51 with 10 ops
 [i0, p1]
 debug_merge_point('StrLiteralSearch at 11/51 [17, 8, 3, 1, 1, 1, 1, 51, 0, 19, 51, 1]')
 i9 = int_lt(i7, i8)
 guard_false(i9, descr=<Guard108>) [i7, p1]
 finish(0, descr=<DoneWithThisFrameDescrInt object at 0x898b4a4>)
-[33541f1effc5] jit-log-opt-bridge}
-[33541f7ad2d8] {jit-log-opt-bridge
+[880580382da] jit-log-opt-bridge}
+[8805871718a] {jit-log-opt-bridge
 # bridge out of Guard 48 with 5 ops
 [i0, p1]
 i3 = int_add(i0, 1)
 setfield_gc(p1, ConstPtr(ptr4), descr=<GcPtrFieldDescr pypy.rlib.rsre.rsre_core.AbstractMatchContext.inst_match_marks 20>)
 setfield_gc(p1, i0, descr=<SignedFieldDescr pypy.rlib.rsre.rsre_core.AbstractMatchContext.inst_match_start 24>)
 finish(1, descr=<DoneWithThisFrameDescrInt object at 0x898b4a4>)
-[33541f7b7196] jit-log-opt-bridge}
-[33541f8e3c55] {jit-log-opt-bridge
+[8805872808e] jit-log-opt-bridge}
+[88058898f86] {jit-log-opt-bridge
 # bridge out of Guard 50 with 5 ops
 [i0, p1]
 i3 = int_add(i0, 1)
 setfield_gc(p1, ConstPtr(ptr4), descr=<GcPtrFieldDescr pypy.rlib.rsre.rsre_core.AbstractMatchContext.inst_match_marks 20>)
 setfield_gc(p1, i0, descr=<SignedFieldDescr pypy.rlib.rsre.rsre_core.AbstractMatchContext.inst_match_start 24>)
 finish(1, descr=<DoneWithThisFrameDescrInt object at 0x898b4a4>)
-[33541f8eaeac] jit-log-opt-bridge}
+[880588a1836] jit-log-opt-bridge}
 0:3
 1:3
-2:604
+2:7604
 3:396
-4:102
+4:3602
 5:2000
 6:3147
 7:2445
 def bridge():
     s = 0
     i = 0
-    while i < 3000:
+    while i < 10000:
         if i % 2:
             s += 1
         else:
 }
 
 .inlined_call {
-    font-size: 15px;
-    color: red;
-	margin: 4em;
+    font-size: 12px;
     font-weight: bold;
 }
 
         for loop_no, loop in enumerate(loops):
             for op in loop.operations:
                 if op.name.startswith('guard_'):
-                    guard_dict[int(op.descr[len('<Guard'):-1])] = op
+                    guard_dict[int(op.descr[len('<Guard'):-1])] = (op, loop)
         for loop in loops:
             if loop.comment:
                 comment = loop.comment.strip()
                     pass
                 elif comment.startswith('# bridge out of'):
                     no = int(comment[len('# bridge out of Guard '):].split(' ', 1)[0])
-                    guard_dict[no].bridge = loop
+                    op, parent = guard_dict[no]
+                    op.bridge = loop
+                    op.percentage = (loop.count * 100) / parent.count
                     loop.no = no
                     continue
             res.append(loop)

templates/index.html

   </header>
   <div id="loops">
     <ul>
-      {% for is_entry_bridge, item in loops %}
+      {% for is_entry_bridge, index, item in loops %}
       {% if is_entry_bridge %}
-        <li><span>Entry bridge: <a href="#" onClick="show_loop({{loop.index}})">{{item.repr()}}</a></span></li>
+        <li><span>Entry bridge: <a href="#" onClick="show_loop({{index}})">{{item.repr()}}</a> run {{item.count}} times</span></li>
       {% else %}
-        <li><span><a href="#" onClick="show_loop({{loop.index}})">{{item.repr()}}</a></span></li>
+        <li><span><a href="#" onClick="show_loop({{index}})">{{item.repr()}}</a> run {{item.count}} times</span></li>
       {% endif %}
       {% endfor %}
     </ul>

templates/loop.html

                    <span class="dmp">{{chunk.html_repr()}}</span><br/>
                    {% for op in chunk.operations[1:] %}
                       {% if op.bridge %}
-                        <span id="loop-{{op.bridge.no}}" class="guard single-operation">{{op.html_repr()}}</span> <a href="#" onClick="replace_from(this, {{op.bridge.no}})">&gt;&gt;show bridge</a><br/>
+                        <span id="loop-{{op.bridge.no}}" class="guard single-operation">{{op.html_repr()}}</span> <a href="#" onClick="replace_from(this, {{op.bridge.no}})">&gt;&gt;show bridge</a> (taken {{op.percentage}}%)<br/>
                       {% else %}
                         <span class="single-operation {{op.extra_style()}}">{{op.html_repr()}}</span><br/>
                       {% endif %}