-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilter.py
103 lines (89 loc) · 2.23 KB
/
filter.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import os
FILE_NAME = 'agorasdk.log'
TAG1 = 'testpacketrate'
TAG2= 'testframerate'
TAG3= 'testjitter'
TAG4= 'testrtt'
size = os.path.getsize(FILE_NAME) / 1024 / 1024
if 10 < size :
print("File too large , it will be take more time for to done. \n")
def fetch1():
fp = open(FILE_NAME)
fp_res = open("packetlost.txt","w")
str1 = 'zxh'
str2 = '}'
for line in fp:
#过滤
if line.find(TAG1) ==-1:
continue
if len(line) < 20:
continue
#匹配
i1 = line.index(str1) +3
i2 = line.index(str2) +0
info = line[i1:i2]
fp_res.write(str(info)+"\n")
print(info)
fp.close()
fp_res.close()
def fetch2():
fp = open(FILE_NAME)
fp_res = open("framelost.txt","w")
str1 = 'zxh'
str2 = '}'
for line in fp:
#过滤
if line.find(TAG2) ==-1:
continue
if len(line) < 20:
continue
#匹配
i1 = line.index(str1) +3
i2 = line.index(str2) +0
info = line[i1:i2]
fp_res.write(str(info)+"\n")
print(info)
fp.close()
fp_res.close()
def fetch3():
fp = open(FILE_NAME)
fp_res = open("jitter.txt","w")
str1 = 'zxh'
str2 = '}'
for line in fp:
#过滤
if line.find(TAG3) ==-1:
continue
if len(line) < 20:
continue
#匹配
i1 = line.index(str1) +3
i2 = line.index(str2) +0
info = line[i1:i2]
fp_res.write(str(info)+"\n")
print(info)
fp.close()
fp_res.close()
def fetch4():
fp = open(FILE_NAME)
fp_res = open("rtt.txt","w")
str1 = 'zxh'
str2 = '}'
for line in fp:
#过滤
if line.find(TAG4) ==-1:
continue
if len(line) < 20:
continue
#匹配
i1 = line.index(str1) +3
i2 = line.index(str2) +0
info = line[i1:i2]
fp_res.write(str(info)+"\n")
print(info)
fp.close()
fp_res.close()
fetch1()
fetch2()
fetch3()
fetch4()