Server IP : 103.191.208.50 / Your IP : 216.73.216.226 Web Server : LiteSpeed System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64 User : celkcksm ( 1031) PHP Version : 5.6.40 Disable Function : show_source, system, shell_exec, passthru, exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/../opt/bitninja-python-dojo/embedded/lib/python3.9/test/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
"""Memory watchdog: periodically read the memory usage of the main test process and print it out, until terminated.""" # stdin should refer to the process' /proc/<PID>/statm: we don't pass the # process' PID to avoid a race condition in case of - unlikely - PID recycling. # If the process crashes, reading from the /proc entry will fail with ESRCH. import os import sys import time try: page_size = os.sysconf('SC_PAGESIZE') except (ValueError, AttributeError): try: page_size = os.sysconf('SC_PAGE_SIZE') except (ValueError, AttributeError): page_size = 4096 while True: sys.stdin.seek(0) statm = sys.stdin.read() data = int(statm.split()[5]) sys.stdout.write(" ... process data size: {data:.1f}G\n" .format(data=data * page_size / (1024 ** 3))) sys.stdout.flush() time.sleep(1)