mirror of https://github.com/ivanch/tcc.git
30 lines
857 B
Python
30 lines
857 B
Python
|
import matplotlib.pyplot as plt
|
||
|
|
||
|
def plot_graph(x, y, title, x_label, y_label, filename):
|
||
|
plt.plot(x, y, 'ro', markersize=1, linewidth=0.5, linestyle='solid')
|
||
|
plt.title(title)
|
||
|
plt.xlabel(x_label)
|
||
|
plt.ylabel(y_label)
|
||
|
plt.savefig(f'{filename}.png')
|
||
|
|
||
|
def getData(filename):
|
||
|
lines = []
|
||
|
with open(filename, 'r') as f:
|
||
|
lines = f.readlines()
|
||
|
|
||
|
x = []
|
||
|
y = []
|
||
|
for line in lines:
|
||
|
line = line.strip().split(',')
|
||
|
if line:
|
||
|
x.append(int(line[0]))
|
||
|
y.append(float(line[1]))
|
||
|
|
||
|
return x, y
|
||
|
|
||
|
def generateGraph(filename, framework_name, endpoint_name):
|
||
|
x, y = getData(filename)
|
||
|
plot_graph(x, y, f'{framework_name} - {endpoint_name}', 'Number of requests', 'Requests per second', filename.split('.')[0])
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
generateGraph('data.txt', 'ASP.NET', 'test')
|