2023-08-24 23:52:15 +00:00
|
|
|
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)
|
2023-08-25 11:40:04 +00:00
|
|
|
new_filename = ".".join(filename.split('.')[:-1])
|
|
|
|
plot_graph(x, y, f'{framework_name} - {endpoint_name}', 'Number of requests', 'Requests per second', new_filename)
|
2023-08-24 23:52:15 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2023-08-25 11:40:04 +00:00
|
|
|
generateGraph('data.txt', 'ASP.NET', 'test')
|