Reduce CPU usage up to 8%
Disable buffering /proc/meminfo
This commit is contained in:
parent
747cff404e
commit
0225fc3bff
@ -1339,7 +1339,7 @@ def find_psi_metrics_value(psi_path, psi_metrics):
|
|||||||
def check_mem_and_swap():
|
def check_mem_and_swap():
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
with open('/proc/meminfo', 'rb') as f:
|
with open('/proc/meminfo', 'rb', buffering=0) as f:
|
||||||
m_list = f.read().decode().split(' kB\n')
|
m_list = f.read().decode().split(' kB\n')
|
||||||
return (int(m_list[2].split(':')[1]),
|
return (int(m_list[2].split(':')[1]),
|
||||||
int(m_list[swap_total_index].split(':')[1]),
|
int(m_list[swap_total_index].split(':')[1]),
|
||||||
|
Loading…
Reference in New Issue
Block a user