diff --git a/nohang b/nohang index f01505a..b354fca 100755 --- a/nohang +++ b/nohang @@ -205,19 +205,16 @@ def pid_to_name(pid): def send_notify_warn(): title = 'LOW MEMORY' if mem_used_zram > 0: - body = 'Mem Available: {} MiB\nSwap Fre' \ - 'e: {} MiB\nMemUsedZram: {} MiB'.format( - kib_to_mib(mem_available), - kib_to_mib(swap_free), - kib_to_mib(mem_used_zram)) + body = 'Mem Available: {} %\nSwap Free: {} %\nMem Used Zram: {} %'.format( + round(mem_available / mem_total * 100), + round(swap_free / (swap_total + 0.1) * 100), + round(mem_used_zram / mem_total * 100)) elif swap_free > 0: - body = 'Mem Available: {} MiB\nSwap Free:' \ - ' {} MiB'.format( - kib_to_mib(mem_available), - kib_to_mib(swap_free)) + body = 'Mem Available: {} %\nSwap Free: {} %'.format( + round(mem_available / mem_total * 100), + round(swap_free / (swap_total + 0.1) * 100)) else: body = 'Mem Available: {} %'.format( - #kib_to_mib(mem_available), round(mem_available / mem_total * 100)) if root: # отправляем уведомление всем залогиненным пользователям @@ -234,7 +231,7 @@ def send_notify_warn(): def send_notify(signal, name, pid, oom_score, vm_rss, vm_swap): - title = 'Nohang TRIGGERED' + title = 'NOHANG TRIGGERED' body = 'Nohang sent {} \nto the process {} \nP' \ 'id: {} \nBadness: {} \nVmRSS: {} MiB \nVmSwap: {} MiB'.format( @@ -395,6 +392,8 @@ def find_victim_and_send_signal(signal): print(badness_is_too_small) + stdout.flush() + sleep_after_send_signal(signal) @@ -1230,9 +1229,6 @@ if print_config: print('\nVI. DESKTOP NOTIFICATIONS') print('gui_notifications: {}'.format(gui_notifications)) - if gui_notifications: - print('notify_options: {}'.format(notify_options)) - print('root_display: {}'.format(root_display)) print('\nVII. AVOID AND PREFER VICTIM NAMES VIA REGEX') print('regex_matching: {}'.format(regex_matching))