UNPKG

@re-shell/cli

Version:

Full-stack development platform uniting microservices and microfrontends. Build complete applications with .NET (ASP.NET Core Web API, Minimal API), Java (Spring Boot, Quarkus, Micronaut, Vert.x), Rust (Actix-Web, Warp, Rocket, Axum), Python (FastAPI, Dja

85 lines (84 loc) 1.95 kB
/** * Memory usage monitoring and optimization alerts */ import { EventEmitter } from 'events'; interface MemoryStats { rss: number; heapTotal: number; heapUsed: number; external: number; arrayBuffers: number; } export declare class MemoryMonitor extends EventEmitter { private static instance; private monitoring; private interval?; private history; private alerts; private readonly WARNING_HEAP; private readonly CRITICAL_HEAP; private readonly WARNING_RSS; private readonly CRITICAL_RSS; private constructor(); static getInstance(): MemoryMonitor; /** * Start memory monitoring */ start(intervalMs?: number): void; /** * Stop memory monitoring */ stop(): void; /** * Get current memory usage */ getCurrentMemory(): MemoryStats; /** * Get formatted memory usage string */ getFormattedMemory(): string; /** * Get memory usage trend */ getMemoryTrend(samples?: number): 'increasing' | 'decreasing' | 'stable'; /** * Get memory statistics */ getStats(): { current: MemoryStats; peak: MemoryStats; average: MemoryStats; trend: string; alerts: number; }; /** * Force garbage collection if available */ forceGC(): boolean; /** * Get optimization suggestions */ getOptimizationSuggestions(): string[]; /** * Check memory and emit alerts if needed */ private checkMemory; /** * Check memory thresholds and create alerts */ private checkThresholds; /** * Create and emit memory alert */ private createAlert; /** * Detect potential memory leaks */ private detectMemoryLeaks; /** * Setup garbage collection hooks if available */ private setupGCHooks; } export declare const memoryMonitor: MemoryMonitor; export {};