fix CLI
This commit is contained in:
parent
9323a9f39f
commit
ec2f960383
6
nohang
6
nohang
@ -13,13 +13,13 @@ from sre_constants import error as invalid_re
|
|||||||
start_time = time()
|
start_time = time()
|
||||||
|
|
||||||
|
|
||||||
help_mess = """usage: nohang [-h] [-v] [-t] [--ppt] [-c CONFIG]
|
help_mess = """usage: nohang [-h] [-v] [-t] [-p] [-c CONFIG]
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
-v, --version print version
|
-v, --version print version
|
||||||
-t, --test print some tests
|
-t, --test print some tests
|
||||||
--ppt, --print-proc-table
|
-p, --print-proc-table
|
||||||
print table of processes with their badness values
|
print table of processes with their badness values
|
||||||
-c CONFIG, --config CONFIG
|
-c CONFIG, --config CONFIG
|
||||||
path to the config file, default values:
|
path to the config file, default values:
|
||||||
@ -1628,7 +1628,7 @@ elif len(argv) == 2:
|
|||||||
print_version()
|
print_version()
|
||||||
elif argv[1] == '--test' or argv[1] == '-t':
|
elif argv[1] == '--test' or argv[1] == '-t':
|
||||||
test()
|
test()
|
||||||
elif argv[1] == '--print-proc-table' or argv[1] == '--ppt':
|
elif argv[1] == '--print-proc-table' or argv[1] == '-p':
|
||||||
print_proc_table_flag = True
|
print_proc_table_flag = True
|
||||||
if os.path.exists('./nohang.conf'):
|
if os.path.exists('./nohang.conf'):
|
||||||
config = os.getcwd() + '/nohang.conf'
|
config = os.getcwd() + '/nohang.conf'
|
||||||
|
2
nohang.1
2
nohang.1
@ -40,7 +40,7 @@ Nohang is a highly configurable daemon for Linux which is able to correctly prev
|
|||||||
|
|
||||||
-t, --test print some tests
|
-t, --test print some tests
|
||||||
|
|
||||||
--ppt, --print-proc-table
|
-p, --print-proc-table
|
||||||
print table of processes with their badness values
|
print table of processes with their badness values
|
||||||
|
|
||||||
-c CONFIG, --config CONFIG
|
-c CONFIG, --config CONFIG
|
||||||
|
@ -3,6 +3,40 @@
|
|||||||
# интерактивный oom-trigger
|
# интерактивный oom-trigger
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from ctypes import CDLL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def mlockall():
|
||||||
|
"""Lock all memory to prevent swapping nohang process."""
|
||||||
|
|
||||||
|
MCL_CURRENT = 1
|
||||||
|
MCL_FUTURE = 2
|
||||||
|
MCL_ONFAULT = 4
|
||||||
|
|
||||||
|
libc = CDLL('libc.so.6', use_errno=True)
|
||||||
|
|
||||||
|
result = libc.mlockall(
|
||||||
|
MCL_CURRENT | MCL_FUTURE | MCL_ONFAULT
|
||||||
|
)
|
||||||
|
if result != 0:
|
||||||
|
result = libc.mlockall(
|
||||||
|
MCL_CURRENT | MCL_FUTURE
|
||||||
|
)
|
||||||
|
if result != 0:
|
||||||
|
log('Cannot lock all memory')
|
||||||
|
else:
|
||||||
|
log('All memory locked with MCL_CURRENT | MCL_FUTURE')
|
||||||
|
else:
|
||||||
|
log('All memory locked with MCL_CURRENT | MCL_FUTURE | MCL_ONFAULT')
|
||||||
|
|
||||||
|
|
||||||
|
mlockall()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from memco import *
|
from memco import *
|
||||||
|
|
||||||
# печать показателей на этапах работы
|
# печать показателей на этапах работы
|
Loading…
Reference in New Issue
Block a user