INNER CODE UNIT · Python
used_GB
tlkh/asitop · asitop/utils.py:73
used_GB = convert_to_GB(ram_metrics.total-ram_metrics.available)
swap_total_GB = convert_to_GB(swap_metrics.total)
swap_used_GB = convert_to_GB(swap_metrics.used)
swap_free_GB = convert_to_GB(swap_metrics.total-swap_metrics.used)
if swap_total_GB > 0:
swap_free_percent = int(100-(swap_free_GB/swap_total_GB*100))
else:
swap_free_percent = None
ram_metrics_dict = {
"total_GB": round(total_GB, 1),
"free_GB": round(free_GB, 1),
"used_GB": round(used_GB, 1),
"free_percent": int(100-(ram_metrics.available/ram_metrics.total*100)),
"swap_total_GB": swap_total_GB,
"swap_used_GB": swap_used_GB,
"swap_free_GB": swap_free_GB,
"swap_free_percent": swap_free_percent,
}