Todo: 集成多平台 解决因SaiNiu线程抢占资源问题 本地提交测试环境打包 和 正式打包脚本与正式环境打包bat 提交Python32环境包 改进多日志文件生成情况修改打包日志细节
This commit is contained in:
21
Utils/PythonNew32/Lib/test/memory_watchdog.py
Normal file
21
Utils/PythonNew32/Lib/test/memory_watchdog.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""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 sys
|
||||
import time
|
||||
from test.support import get_pagesize
|
||||
|
||||
|
||||
while True:
|
||||
page_size = get_pagesize()
|
||||
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)
|
||||
Reference in New Issue
Block a user