forked from se2p/FlaPy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
timerun.py
54 lines (51 loc) · 1.64 KB
/
timerun.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
'''
david-time-second-2
1627724068
Project name: accessify
Project url: [email protected]:dmytrostriletskyi/accessify
Project hash: 6b7cf8657ffe18cd6a43c6cfb73b071084f0331e
Funcs to trace:
Num runs: 1
david-time-second-1
1627724068
Project name: accessify
Project url: [email protected]:dmytrostriletskyi/accessify
Project hash: 6b7cf8657ffe18cd6a43c6cfb73b071084f0331e
Funcs to trace:
Num runs: 1
'''
import sys
def extract(nameline, urlline, hashline):
l1 = nameline.strip()
l2 = urlline.strip()
l3 = hashline.strip()
key1 = "Project name: "
key2 = "Project url: "
key3 = "Project hash: "
assert key1 in l1
assert key2 in l2
assert key3 in l3
return l1.replace(key1, ""), l2.replace(key2, ""), l3.replace(key3, "")
def second(line1, line2, times):
l1 = line1.strip()
l2 = line2.strip()
key = "david-time-second-" + str(times)
assert key in l1
return int(l2)
with open("log", "r") as f:
lines = f.readlines()
start_time = 0
end_time = 0
name = ""
url = ""
sha = ""
for i in range(0, len(lines)):
if "david-time-second-1" in lines[i]:
start_time = second(lines[i], lines[i+1], 1)
name, url, sha = extract(lines[i+2], lines[i+3], lines[i+4])
if "david-time-second-2" in lines[i]:
end_time = second(lines[i], lines[i+1], 2)
duration = end_time - start_time
if duration >= 3600 - 10:
print(",".join([name,url,sha,str(duration),"timeout"]), file=sys.stderr)
print(",".join([name,url,sha,str(duration)]))