File size: 833 Bytes
784ee2c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import re

startpoint = "Startpoint"
pattern = "(hold\d+)"
res = {}
count = 0
maxcount = 0
linindex = 0
lincount = 0
with open("reports/gf12/bp_single/min_delay_report_osta.rpt", "r") as f:
    while True:
        line = f.readline()
        lincount += 1
        if not line:
            break

        m1 = re.search(startpoint, line)
        m2 = re.search(pattern, line)
        if m1:
            if count == 0:
                continue
            elif count in res.keys():
                res[count] += 1
            else:
                res[count] = 1
                if count > maxcount:
                    maxcount = count
                    linindex = lincount
            count = 0
        elif m2:
            count += 1

for key, val in res.items():
    print("%d: %d" % (key, val))

print(maxcount)
print(linindex)