신규 모듈 — harness/perf.py (54 LOC):
- perf_block(label) 컨텍스트 매니저 — 블록 단위 wall-clock + CPU 시간을 ms 단위로 측정.
- set_perf_log(callable) — 외부 sink 등록 (예: app.log 호출 시 GUI 패널에 표시).
- 출력 형식: [PERF] {label}: wall={NN}ms cpu={NN}ms ({CPU|I/O/Net}-bound).
- cpu/wall > 0.5 면 CPU-bound로 분류, 그 외 I/O/Net-bound (GIL 풀린 시간 비율).
Wire 5곳 — scanvas_maker.py:
- import 블록 (~line 58): from harness.perf import perf_block, set_perf_log
+ ImportError 시 contextlib.contextmanager 노옵 폴백 (모듈 누락 환경 대응).
- SCanvasApp.__init__ (~line 613): set_perf_log(self.log) 등록.
- TIN densify Phase C (line ~4430): with perf_block("TIN densify Phase C (10m→1m)").
- 위성 타일 다운로드 (line ~5384): with perf_block("위성 타일 다운로드+병합").
- 제어맵 캡처 x3 + composite (line ~5864): with perf_block("control map capture x3 + composite").
핫스팟 매핑 (PERFORMANCE_BASELINE.md): H1 (위성 타일), H3 (TIN densify), H12 (capture).
검증:
- python -m py_compile scanvas_maker.py harness/perf.py 통과.
- AST parse OK (39 top-level statements).
- ruff Green 정식 검증은 글로벌 ruff 설치 후 (uv pip install -e ".[dev]"; ruff check).
CHANGELOG.md 에 #11 perf instrumentation 항목 추가 (2026-05-08).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
338 KiB
338 KiB