mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
The memory report's system line asked for the heap's summary at every report until one was slow. The summary holds the heap's lock, and every malloc of every thread with it, while it adds the heap up: 54 and 70 ms in two sessions on an RTX 5090 PC, and the frame of the first report, 30 seconds into each session, took 55 to 82 ms, the longest frame of play in both. One slow summary switched the question off, so every session paid for it once. It is now asked for before play only (the boot and the title screen), and at every report with mem_census = 1, which already accepts a late frame for the walk of the address space. In play the line gives what the runtime knows it allocated, the same figure from one report to the next. The rule is in runtime/vk_mem_heap.h with tests/mem_heap_check, which fails against the rule before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
"""Build and run tests/mem_heap_check.c: runtime/vk_mem_heap.h, when the memory report asks for the C runtime heap's
|
|
summary (vk_memory.c system_log): never in play, where it held every allocation of the game for 54 to 70 ms at the
|
|
first report of a session, unless mem_census asks for it.
|
|
|
|
No GPU, no game files, any Python.
|
|
|
|
Usage: mem_heap_check.py
|
|
"""
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
MSYS_BIN = Path(r'C:\msys64\ucrt64\bin')
|
|
|
|
|
|
def compiler():
|
|
"""$CC, else MSYS2 UCRT64's clang, else clang on PATH (as tests/diff/common.py picks it, without its Unicorn)."""
|
|
if os.environ.get('CC'):
|
|
return os.environ['CC']
|
|
if os.name == 'nt' and (MSYS_BIN / 'clang.exe').exists():
|
|
return str(MSYS_BIN / 'clang.exe')
|
|
return shutil.which('clang') or 'clang'
|
|
|
|
|
|
def main():
|
|
work = ROOT / 'build' / 'test' / 'mem_heap'
|
|
work.mkdir(parents=True, exist_ok=True)
|
|
exe = work / ('mem_heap_check.exe' if os.name == 'nt' else 'mem_heap_check')
|
|
env = dict(os.environ)
|
|
if os.name == 'nt' and MSYS_BIN.exists():
|
|
env['PATH'] = str(MSYS_BIN) + os.pathsep + env.get('PATH', '')
|
|
subprocess.check_call([compiler(), '-std=gnu11', '-O1', '-Wall', '-Werror', '-I', str(ROOT / 'runtime'),
|
|
str(ROOT / 'tests' / 'mem_heap_check.c'), '-o', str(exe)], env=env)
|
|
return subprocess.run([str(exe)], env=env).returncode
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|