Migrate Get Requests invocations(libraries)
[integration/test.git] / tools / odl-mdsal-clustering-tests / clustering-performance-test / create_plot_data_files.py
1 #!/usr/bin/python
2 import re
3
4 text_file = open("out.log.txt", "r")
5 log = text_file.read()
6 text_file.close()
7
8 rate = []
9 time = []
10
11 pat_rate = re.compile(
12     r"Avg. requests/s: (?P<rate1>[0-9,\.]+) OK, (?P<rate2>[0-9,\.]+) Total"
13 )
14 pat_time = re.compile(r"Stats collected in (?P<time1>[0-9,\.]+) seconds")
15
16 for line in log.splitlines():
17     res = pat_rate.search(line)
18     if res is not None:
19         rate.append(res.groups("rate1")[0])
20 print(rate)
21
22 for line in log.splitlines():
23     res = pat_time.search(line)
24     if res is not None:
25         time.append(res.groups("time1")[0])
26 print(time)
27
28 text_file = open("rates.csv", "w")
29 text_file.write("Add,Delete\n")
30 text_file.write("{0},{1}\n".format(rate[0], rate[1]))
31 text_file.close()
32
33 text_file = open("times.csv", "w")
34 text_file.write("Add,Delete\n")
35 text_file.write("{0},{1}\n".format(time[0], time[1]))
36 text_file.close()