UNPKG

nestjs-mvc-tools

Version:

NestJS MVC Tools is a small set of tools designed to help you get started more easily with traditional web development approaches in NestJS.

59 lines (58 loc) 1.4 kB
/** * 메모리 모니터링 유틸리티 * 디버그 모드에서 메모리 사용량 추적 및 렌더러 인스턴스 모니터링 */ export interface MemorySnapshot { timestamp: number; rss: number; heapUsed: number; heapTotal: number; external: number; arrayBuffers: number; } export interface MemoryStats { rendererCount: number; snapshots: MemorySnapshot[]; peakMemory: MemorySnapshot; averageMemory: { rss: number; heapUsed: number; }; } export declare class MemoryMonitor { private static instance; private rendererCounter; private activeRenderers; private snapshots; private readonly maxSnapshots; private constructor(); static getInstance(): MemoryMonitor; /** * 렌더러 생성 시 호출 */ onRendererCreated(renderer: any): void; /** * 현재 메모리 스냅샷 생성 */ takeSnapshot(): MemorySnapshot; /** * 메모리 통계 반환 */ getStats(): MemoryStats; /** * 메모리 임계값 체크 */ checkThreshold(thresholdMB?: number): boolean; /** * 가비지 컬렉션 강제 실행 (개발 환경에서만) */ forceGC(): void; /** * 통계 초기화 */ reset(): void; /** * 메모리 사용량을 포맷된 문자열로 반환 */ getFormattedMemoryUsage(): string; }