removed process info from run-onionr-node script

This commit is contained in:
Kevin Froman 2021-01-22 18:55:58 +00:00
parent cb2e29ad6e
commit 8083489110

View File

@ -9,10 +9,8 @@ from subprocess import DEVNULL
import ujson import ujson
from psutil import Popen from psutil import Popen
from psutil import Process from psutil import Process
import psutil
import sys import sys
import curses
script_dir = os.path.dirname(os.path.realpath(__file__)) script_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(script_dir + '/src/') sys.path.append(script_dir + '/src/')
@ -23,36 +21,6 @@ from etc import onionrvalues
sub_script = script_dir + '/' + onionrvalues.SCRIPT_NAME sub_script = script_dir + '/' + onionrvalues.SCRIPT_NAME
def show_info(p: Process):
def pbar(window):
window.addstr(8, 10, "Onionr statistics")
window.addstr(9, 10, "-" * 17)
curses.curs_set(0)
while True:
threads = p.num_threads()
open_files = len(p.open_files())
cpu_percent = p.cpu_percent()
block_count = len(blockmetadb.get_block_list())
for proc in p.children(recursive=True):
threads += proc.num_threads()
cpu_percent += proc.cpu_percent()
try:
open_files += len(proc.open_files())
except psutil.AccessDenied:
pass
cpu_percent = cpu_percent * 100
window.addstr(11, 10, f"Threads: {threads}")
window.addstr(10, 10, f"Open files: {open_files}")
window.addstr(12, 10, f"CPU: {cpu_percent}%")
window.addstr(13, 10, f"Blocks: {block_count}")
window.refresh()
sleep(0.5)
sleep(15)
curses.wrapper(pbar)
while True:
sleep(1)
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument(
@ -179,6 +147,4 @@ else:
p = Popen([sub_script, 'start'], stdout=DEVNULL) p = Popen([sub_script, 'start'], stdout=DEVNULL)
p = p.children()[0] p = p.children()[0]
if args.show_stats:
Thread(target=show_info, args=[p], daemon=True).start()
p.wait() p.wait()