mirror of https://github.com/ivanch/tcc.git
Compare commits
2 Commits
6d8ec28dbb
...
3533491df1
Author | SHA1 | Date |
---|---|---|
José Henrique | 3533491df1 | |
José Henrique | 6f2d9c1f78 |
|
@ -25,10 +25,10 @@ def plot_resource_graph(x_data, y_data, title, x_label, y_label, filename):
|
||||||
frameworks[framework] = y_data[i]
|
frameworks[framework] = y_data[i]
|
||||||
|
|
||||||
x = np.arange(len(requests))
|
x = np.arange(len(requests))
|
||||||
width = 0.10
|
width = 0.2
|
||||||
multiplier = 0
|
multiplier = 0
|
||||||
|
|
||||||
fig, ax = plt.subplots(layout='constrained')
|
fig, ax = plt.subplots(layout='constrained', figsize=(7.5, 5))
|
||||||
|
|
||||||
print(x)
|
print(x)
|
||||||
for framework, measurements in frameworks.items():
|
for framework, measurements in frameworks.items():
|
||||||
|
@ -45,9 +45,9 @@ def plot_resource_graph(x_data, y_data, title, x_label, y_label, filename):
|
||||||
ax.set_xlabel(x_label)
|
ax.set_xlabel(x_label)
|
||||||
ax.set_ylabel(y_label)
|
ax.set_ylabel(y_label)
|
||||||
ax.set_title(title)
|
ax.set_title(title)
|
||||||
ax.set_xticks(x + (width/2), requests)
|
ax.set_xticks(x + (width*1.5), requests)
|
||||||
ax.legend(loc='upper left', ncols=len(frameworks.items()))
|
ax.legend(loc='upper left', ncols=len(frameworks.items()))
|
||||||
ax.set_ylim(0, 120)
|
ax.set_ylim(0, 115)
|
||||||
|
|
||||||
plt.savefig(f'{filename}.png')
|
plt.savefig(f'{filename}.png')
|
||||||
|
|
||||||
|
@ -79,8 +79,15 @@ def get_resource_data(filename):
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line = line.strip().split(',')
|
line = line.strip().split(',')
|
||||||
if line:
|
if line:
|
||||||
|
r = [round(float(line[1])*100), round(float(line[2])*100)]
|
||||||
|
if r[0] > 100:
|
||||||
|
r[0] = 100
|
||||||
|
|
||||||
|
if r[1] > 100:
|
||||||
|
r[1] = 100
|
||||||
|
|
||||||
x.append(int(line[0])) # requests
|
x.append(int(line[0])) # requests
|
||||||
y.append([float(v)*100 for v in line[1:]]) # cpu, ram
|
y.append(r) # cpu, ram
|
||||||
|
|
||||||
return x, y
|
return x, y
|
||||||
|
|
||||||
|
@ -109,7 +116,7 @@ def generate_resource_graph(filename, framework_name, endpoint_name):
|
||||||
y.append([data[resource_index] for data in y_data])
|
y.append([data[resource_index] for data in y_data])
|
||||||
|
|
||||||
graph_file = f'{resource}_{endpoint_name.replace("/", "").replace("?", "")}'
|
graph_file = f'{resource}_{endpoint_name.replace("/", "").replace("?", "")}'
|
||||||
plot_resource_graph(x, y, f'Uso de {resource.upper()} - {endpoint_name}', 'Número de requisições', 'Uso (%)', graph_file)
|
plot_resource_graph(x, y, f'Uso de {resource.upper()} - {endpoint_name}', 'Número de requisições', f'Uso de {resource.upper()} (%)', graph_file)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
endpoints = [config[0] for config in API_REQUESTS]
|
endpoints = [config[0] for config in API_REQUESTS]
|
||||||
|
|
Loading…
Reference in New Issue