fix psi support

This commit is contained in:
Alexey Avramov 2019-01-02 04:07:55 +09:00
parent 0b577b54dc
commit 97c153247f

11
nohang
View File

@ -35,8 +35,7 @@ cache_path = '/dev/shm/nohang_env_cache'
def psi_mem_some_avg_total(): def psi_mem_some_avg_total():
if os.path.exists('/proc/pressure/memory'): if os.path.exists('/proc/pressure/memory'):
return float(rline1( return float(rline1('/proc/pressure/memory').rpartition('=')[2])
'/proc/pressure/memory').rpartition('=')[2]
def check_mem(): def check_mem():
@ -1537,9 +1536,9 @@ avg_min_time = 3
sigterm_psi = 60 sigterm_psi = 60
sigkill_psi = 80 sigkill_psi = 80
if psi_support:
ta0 = time() ta0 = time()
a0 = avg_total() a0 = psi_mem_some_avg_total()
while True: while True:
@ -1548,7 +1547,7 @@ while True:
if psi_support: if psi_support:
ta1= time() ta1= time()
a1 = avg_total() a1 = psi_mem_some_avg_total()
avg = (a1 - a0) / (ta1 - ta0) / 100 avg = (a1 - a0) / (ta1 - ta0) / 100
a0 = a1 a0 = a1