From 51d09be512076da6f3ae6169c95a9a428073072f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Henrique=20Ivanchechen?= Date: Thu, 31 Aug 2023 20:07:14 -0300 Subject: [PATCH] fixes --- scripts/graph.py | 4 +++- scripts/testes.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/graph.py b/scripts/graph.py index aca7dbf..4b04eb2 100644 --- a/scripts/graph.py +++ b/scripts/graph.py @@ -9,6 +9,7 @@ def plot_graph(x, y, title, x_label, y_label, filename): plt.savefig(f'{filename}.png') plt.clf() + plt.close('all') def plot_resource_graph(x_data, y_data, title, x_label, y_label, filename): requests = x_data @@ -36,11 +37,12 @@ def plot_resource_graph(x_data, y_data, title, x_label, y_label, filename): ax.set_title(title) ax.set_xticks(x + width, requests) ax.legend(loc='upper left', ncols=len(resource.items())) - ax.set_ylim(0, 250) + ax.set_ylim(0, 100) plt.savefig(f'resources_{filename}.png') plt.clf() + plt.close('all') def get_data(filename): lines = [] diff --git a/scripts/testes.py b/scripts/testes.py index faa11d6..8fbfc65 100644 --- a/scripts/testes.py +++ b/scripts/testes.py @@ -120,14 +120,14 @@ def get_cpu_usage(stats): UsageDelta = stats['cpu_stats']['cpu_usage']['total_usage'] - stats['precpu_stats']['cpu_usage']['total_usage'] SystemDelta = stats['cpu_stats']['system_cpu_usage'] - stats['precpu_stats']['system_cpu_usage'] len_cpu = stats['cpu_stats']['online_cpus'] - percentage = (UsageDelta / SystemDelta) * len_cpu * 100 + percentage = (UsageDelta / SystemDelta) * len_cpu return f"{percentage:.2f}" def get_ram_usage(stats): usage = stats['memory_stats']['usage'] limit = stats['memory_stats']['limit'] - percentage = (usage / limit) * 100 + percentage = (usage / limit) # percent = round(percentage, 2) return f"{percentage:.2f}"