mirror of https://github.com/ivanch/tcc.git
fixes
This commit is contained in:
parent
209275cce0
commit
51d09be512
|
@ -9,6 +9,7 @@ def plot_graph(x, y, title, x_label, y_label, filename):
|
||||||
plt.savefig(f'{filename}.png')
|
plt.savefig(f'{filename}.png')
|
||||||
|
|
||||||
plt.clf()
|
plt.clf()
|
||||||
|
plt.close('all')
|
||||||
|
|
||||||
def plot_resource_graph(x_data, y_data, title, x_label, y_label, filename):
|
def plot_resource_graph(x_data, y_data, title, x_label, y_label, filename):
|
||||||
requests = x_data
|
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_title(title)
|
||||||
ax.set_xticks(x + width, requests)
|
ax.set_xticks(x + width, requests)
|
||||||
ax.legend(loc='upper left', ncols=len(resource.items()))
|
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.savefig(f'resources_{filename}.png')
|
||||||
|
|
||||||
plt.clf()
|
plt.clf()
|
||||||
|
plt.close('all')
|
||||||
|
|
||||||
def get_data(filename):
|
def get_data(filename):
|
||||||
lines = []
|
lines = []
|
||||||
|
|
|
@ -120,14 +120,14 @@ def get_cpu_usage(stats):
|
||||||
UsageDelta = stats['cpu_stats']['cpu_usage']['total_usage'] - stats['precpu_stats']['cpu_usage']['total_usage']
|
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']
|
SystemDelta = stats['cpu_stats']['system_cpu_usage'] - stats['precpu_stats']['system_cpu_usage']
|
||||||
len_cpu = stats['cpu_stats']['online_cpus']
|
len_cpu = stats['cpu_stats']['online_cpus']
|
||||||
percentage = (UsageDelta / SystemDelta) * len_cpu * 100
|
percentage = (UsageDelta / SystemDelta) * len_cpu
|
||||||
return f"{percentage:.2f}"
|
return f"{percentage:.2f}"
|
||||||
|
|
||||||
def get_ram_usage(stats):
|
def get_ram_usage(stats):
|
||||||
usage = stats['memory_stats']['usage']
|
usage = stats['memory_stats']['usage']
|
||||||
limit = stats['memory_stats']['limit']
|
limit = stats['memory_stats']['limit']
|
||||||
|
|
||||||
percentage = (usage / limit) * 100
|
percentage = (usage / limit)
|
||||||
|
|
||||||
# percent = round(percentage, 2)
|
# percent = round(percentage, 2)
|
||||||
return f"{percentage:.2f}"
|
return f"{percentage:.2f}"
|
||||||
|
|
Loading…
Reference in New Issue