mirror of https://github.com/ivanch/tcc.git
fix cpu
This commit is contained in:
parent
c101d0ca5e
commit
83605f9095
|
@ -114,14 +114,9 @@ def get_resource_usage():
|
|||
|
||||
def get_cpu_usage(stats):
|
||||
UsageDelta = stats['cpu_stats']['cpu_usage']['total_usage'] - stats['precpu_stats']['cpu_usage']['total_usage']
|
||||
|
||||
SystemDelta = stats['cpu_stats']['cpu_usage']['system_cpu_usage'] - stats['precpu_stats']['cpu_usage']['system_cpu_usage']
|
||||
|
||||
len_cpu = len(stats['cpu_stats']['cpu_usage']['percpu_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
|
||||
|
||||
# percent = round(percentage, 2)
|
||||
return f"{percentage:.2f}"
|
||||
|
||||
def get_ram_usage(stats):
|
||||
|
|
Loading…
Reference in New Issue