Debian Codegraph @

rpython/jit/tool/test/test_loopcounter.py

raw symbols SCIP
1 from cStringIO import StringIO
2 from rpython.jit.tool.loopcounter import count_loops_and_bridges
3
4 def test_loopcounter():
5 log = StringIO("""
6 [1200] {stuff
7 ...
8 [1201] stuff}
9 [120a] {jit-mem-looptoken-alloc
10 allocating Loop # 0
11 [120b] jit-mem-looptoken-alloc}
12 [1300] {jit-mem-looptoken-alloc
13 allocating Bridge # 1 of Loop # 0
14 [1301] jit-mem-looptoken-alloc}
15 [1400] {jit-mem-looptoken-alloc
16 allocating Bridge # 2 of Loop # 0
17 [1401] jit-mem-looptoken-alloc}
18 [1500] {jit-mem-looptoken-alloc
19 allocating Loop # 1
20 [1501] jit-mem-looptoken-alloc}
21 [1600] {jit-mem-looptoken-free
22 freeing Loop # 0 with 2 attached bridges
23 [1601] jit-mem-looptoken-free}
24 """)
25 lines = list(count_loops_and_bridges(log))
26 assert lines == [
27 # time total loops bridges
28 (0x00a, 1, 1, 0),
29 (0x100, 2, 1, 1),
30 (0x200, 3, 1, 2),
31 (0x300, 4, 2, 2),
32 (0x400, 1, 1, 0),
33 ]