improve output
This commit is contained in:
parent
ac2572190c
commit
6c62443718
46
src/nohang
46
src/nohang
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from ctypes import CDLL
|
from ctypes import CDLL
|
||||||
from time import sleep, monotonic, process_time
|
from time import sleep, monotonic
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from sys import stdout, stderr, argv, exit
|
from sys import stdout, stderr, argv, exit
|
||||||
from re import search
|
from re import search
|
||||||
@ -807,12 +807,12 @@ def signal_handler(signum, frame):
|
|||||||
|
|
||||||
print_stat_dict()
|
print_stat_dict()
|
||||||
|
|
||||||
m = monotonic() - m0
|
m = monotonic() - start_time
|
||||||
pt = process_time() - pt0
|
user_time, system_time = os.times()[0:2]
|
||||||
pt_percent = pt / m * 100
|
p_time = user_time + system_time
|
||||||
|
p_percent = p_time / m * 100
|
||||||
log('CPU time since monitoring has started: {} ({}%); exit.'.format(
|
log('Process time: {}s (average: {}%); exit.'.format(
|
||||||
format_time(pt), round(pt_percent, 3)))
|
round(p_time, 2), round(p_percent, 2)))
|
||||||
|
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
@ -2364,8 +2364,7 @@ def implement_corrective_action(
|
|||||||
zram_info,
|
zram_info,
|
||||||
psi_info):
|
psi_info):
|
||||||
|
|
||||||
log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'
|
log(separator_in)
|
||||||
'>>>>>>>>>>>>>>')
|
|
||||||
|
|
||||||
debug_corrective_action = True
|
debug_corrective_action = True
|
||||||
|
|
||||||
@ -2425,8 +2424,7 @@ def implement_corrective_action(
|
|||||||
|
|
||||||
sleep(over_sleep)
|
sleep(over_sleep)
|
||||||
|
|
||||||
log('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'
|
log(separator_out)
|
||||||
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
|
|
||||||
|
|
||||||
return psi_t0
|
return psi_t0
|
||||||
|
|
||||||
@ -2436,8 +2434,7 @@ def implement_corrective_action(
|
|||||||
log('Sleep {}s'.format(over_sleep))
|
log('Sleep {}s'.format(over_sleep))
|
||||||
sleep(over_sleep)
|
sleep(over_sleep)
|
||||||
|
|
||||||
log('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'
|
log(separator_out)
|
||||||
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
|
|
||||||
|
|
||||||
return psi_t0
|
return psi_t0
|
||||||
|
|
||||||
@ -2489,8 +2486,7 @@ def implement_corrective_action(
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
log('Thresholds is not exceeded now')
|
log('Thresholds is not exceeded now')
|
||||||
log('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'
|
log(separator_out)
|
||||||
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
|
|
||||||
return psi_t0
|
return psi_t0
|
||||||
|
|
||||||
for i in mem_info_list:
|
for i in mem_info_list:
|
||||||
@ -2498,8 +2494,7 @@ def implement_corrective_action(
|
|||||||
|
|
||||||
if new_threshold is None or new_threshold == 'WARN':
|
if new_threshold is None or new_threshold == 'WARN':
|
||||||
log('Thresholds is not exceeded now')
|
log('Thresholds is not exceeded now')
|
||||||
log('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'
|
log(separator_out)
|
||||||
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
|
|
||||||
return psi_t0
|
return psi_t0
|
||||||
|
|
||||||
threshold = new_threshold
|
threshold = new_threshold
|
||||||
@ -2523,8 +2518,7 @@ def implement_corrective_action(
|
|||||||
log('Sleep {}s'.format(over_sleep))
|
log('Sleep {}s'.format(over_sleep))
|
||||||
sleep(over_sleep)
|
sleep(over_sleep)
|
||||||
|
|
||||||
log('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'
|
log(separator_out)
|
||||||
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
|
|
||||||
|
|
||||||
return psi_t0
|
return psi_t0
|
||||||
|
|
||||||
@ -2537,8 +2531,7 @@ def implement_corrective_action(
|
|||||||
else:
|
else:
|
||||||
sleep(over_sleep)
|
sleep(over_sleep)
|
||||||
|
|
||||||
log('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'
|
log(separator_out)
|
||||||
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
|
|
||||||
|
|
||||||
return psi_t0
|
return psi_t0
|
||||||
|
|
||||||
@ -2766,8 +2759,7 @@ def implement_corrective_action(
|
|||||||
log('Sleep {}s'.format(over_sleep))
|
log('Sleep {}s'.format(over_sleep))
|
||||||
sleep(over_sleep)
|
sleep(over_sleep)
|
||||||
|
|
||||||
log('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'
|
log(separator_out)
|
||||||
'<<<<<<<<<<<<<<<<<')
|
|
||||||
|
|
||||||
return psi_t0
|
return psi_t0
|
||||||
|
|
||||||
@ -3082,9 +3074,13 @@ except ValueError:
|
|||||||
detailed_rss = False
|
detailed_rss = False
|
||||||
# print('It is not Linux 4.5+')
|
# print('It is not Linux 4.5+')
|
||||||
|
|
||||||
|
config = os.path.abspath(config)
|
||||||
|
|
||||||
log('config: ' + config)
|
log('config: ' + config)
|
||||||
|
|
||||||
|
separator_in = '>>' + '=' * 75 + '>>'
|
||||||
|
separator_out = '<<' + '=' * 75 + '<<'
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
@ -3849,10 +3845,6 @@ if ZFS:
|
|||||||
ZFS = False
|
ZFS = False
|
||||||
|
|
||||||
|
|
||||||
m0 = monotonic()
|
|
||||||
pt0 = process_time()
|
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
(masf_threshold, masf_info, mem_available, hard_threshold_min_swap_kb,
|
(masf_threshold, masf_info, mem_available, hard_threshold_min_swap_kb,
|
||||||
|
Loading…
Reference in New Issue
Block a user