mirror of
				https://github.com/ivanch/tcc.git
				synced 2025-10-31 01:17:37 +00:00 
			
		
		
		
	melhorias nos gráficos
This commit is contained in:
		| @@ -1,6 +1,5 @@ | ||||
| import numpy as np | ||||
| import matplotlib.pyplot as plt | ||||
| import os | ||||
| from common import API_REQUESTS, FRAMEWORKS | ||||
|  | ||||
| FRAMEWORKS = [f for f, _ in FRAMEWORKS] | ||||
| @@ -26,10 +25,10 @@ def plot_resource_graph(x_data, y_data, title, x_label, y_label, filename): | ||||
|         frameworks[framework] = y_data[i] | ||||
|  | ||||
|     x = np.arange(len(requests)) | ||||
|     width = 0.10 | ||||
|     width = 0.2 | ||||
|     multiplier = 0 | ||||
|  | ||||
|     fig, ax = plt.subplots(layout='constrained') | ||||
|     fig, ax = plt.subplots(layout='constrained', figsize=(7.5, 5)) | ||||
|  | ||||
|     print(x) | ||||
|     for framework, measurements in frameworks.items(): | ||||
| @@ -46,9 +45,9 @@ def plot_resource_graph(x_data, y_data, title, x_label, y_label, filename): | ||||
|     ax.set_xlabel(x_label) | ||||
|     ax.set_ylabel(y_label) | ||||
|     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.set_ylim(0, 120) | ||||
|     ax.set_ylim(0, 115) | ||||
|  | ||||
|     plt.savefig(f'{filename}.png') | ||||
|  | ||||
| @@ -80,8 +79,15 @@ def get_resource_data(filename): | ||||
|     for line in lines: | ||||
|         line = line.strip().split(',') | ||||
|         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 | ||||
|             y.append([float(v)*100 for v in line[1:]]) # cpu, ram | ||||
|             y.append(r) # cpu, ram | ||||
|  | ||||
|     return x, y | ||||
|  | ||||
| @@ -110,7 +116,7 @@ def generate_resource_graph(filename, framework_name, endpoint_name): | ||||
|             y.append([data[resource_index] for data in y_data]) | ||||
|  | ||||
|         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__': | ||||
|     endpoints = [config[0] for config in API_REQUESTS] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user