-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse_latency.py
82 lines (65 loc) · 1.5 KB
/
parse_latency.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#! /usr/bin/env python
import sys
import os
file = sys.argv[1]
dir = sys.argv[2] + "/"
if not os.path.exists(dir):
os.makedirs(dir)
fp = open(dir+"P","w")
ff = open(dir+"F","w")
fut = open(dir+"Ut","w")
fui = open(dir+"Ui","w")
fud = open(dir+"Ud","w")
fmt = open(dir+"Mt","w")
fma = open(dir+"Ma","w")
fmo = open(dir+"Mo","w")
fmv = open(dir+"Mv","w")
fms = open(dir+"Ms","w")
fmp = open(dir+"Mp","w")
def getValue(line, char):
value = ''
length = len(char)
index = line.find(char + ':')
if (index >= 0):
part = line[index:]
ispace = part.find(',')
if(ispace >= 0):
value = part[(length+1):ispace] + '\n'
else:
value = part[(length+1):] + '\n'
return value
with open(file,'r') as f:
for line in f:
P = getValue(line,'P')
fp.write(P)
F = getValue(line,'F')
ff.write(F)
ut = getValue(line,'Ut')
fut.write(ut)
ui = getValue(line,'Ui')
fui.write(ui)
ud = getValue(line,'Ud')
fud.write(ud)
mt = getValue(line,'Mt')
fmt.write(mt)
ma = getValue(line,'Ma')
fma.write(ma)
mo = getValue(line,'Mo')
fmo.write(mo)
mv = getValue(line,'Mv')
fmv.write(mv)
ms = getValue(line,'Ms')
fms.write(ms)
mp = getValue(line,'Mp')
fmp.write(mp)
fp.close()
ff.close()
fut.close()
fui.close()
fud.close()
fmt.close()
fma.close()
fmo.close()
fmv.close()
fms.close()
fmp.close()