interface MemoryUsage { rss: number; heapTotal: number; heapUsed: number; external: number; } interface ProfileEntry { name: string; startTime: number; endTime?: number; duration?: number; callCount: number; totalDuration: number; maxDuration: number; minDuration: number; parent?: string; children: string[]; memoryBefore?: MemoryUsage; memoryAfter?: MemoryUsage; memoryDelta?: MemoryUsage; maxMemoryDelta?: MemoryUsage; } interface PerformanceAlert { functionName: string; threshold: number; actualValue: number; alertType: 'execution_time' | 'memory_usage'; timestamp: number; } interface Hotspot { functionName: string; impact: number; totalDuration: number; callCount: number; averageDuration: number; percentageOfTotal: number; } interface RegressionReport { functionName: string; baselineAverage: number; currentAverage: number; regressionPercentage: number; severity: 'low' | 'medium' | 'high' | 'critical'; } interface ProfilerConfig { enableMemoryTracking: boolean; enableHierarchicalProfiling: boolean; enablePerformanceAlerts: boolean; executionTimeThreshold: number; memoryThreshold: number; enableHotspotDetection: boolean; hotspotThreshold: number; enableRegressionDetection: boolean; baselineFile?: string; } interface ProfileHierarchyNode { name: string; callCount: number; totalDuration: number; averageDuration: number; children: Record; circular?: boolean; truncated?: boolean; } /** * Advanced performance profiler for timing function execution * Tracks call counts, total time, memory usage, hierarchical relationships, and performance metrics */ export declare class Profiler { private static instance; private entries; private callStack; private enabled; private config; private alerts; private baselines; private baselineLoaded; private debug; private constructor(); static getInstance(): Profiler; /** * Configure profiler settings * @param config - Configuration options */ configure(config: Partial): void; /** * Set debug mode for controlling console output * @param debug - Whether to enable debug output */ setDebug(debug: boolean): void; /** * Get current debug mode */ getDebug(): boolean; /** * Get current profiler configuration */ getConfig(): ProfilerConfig; /** * Start timing a function * @param name - Name of the function being profiled */ start(name: string): void; /** * End timing a function * @param name - Name of the function being profiled */ end(name: string): void; /** * Profile a function execution using a decorator pattern * @param name - Name to use for profiling * @param fn - Function to profile * @returns Wrapped function that will be profiled */ profile any>(name: string, fn: T): T; /** * Print profiling results to console */ printResults(): void; /** * Export profiling data to JSON format * @param filePath - Path to save the export file */ exportToJSON(filePath: string): void; /** * Export profiling data to CSV format * @param filePath - Path to save the export file */ exportToCSV(filePath: string): void; /** * Save current performance data as baseline for regression detection * @param filePath - Optional custom path for baseline file */ saveBaseline(filePath?: string): void; /** * Load baseline data for regression detection */ private loadBaseline; /** * Check for performance alerts based on configured thresholds */ private checkPerformanceAlerts; /** * Detect performance hotspots based on execution time and call frequency */ private detectHotspots; /** * Detect performance regressions by comparing current data with baseline */ private detectRegressions; /** * Print performance alerts */ private printAlerts; /** * Print detected hotspots */ private printHotspots; /** * Print regression report */ private printRegressionReport; /** * Get hierarchical view of function calls */ getHierarchicalView(): Record; /** * Build subtree for hierarchical view */ private buildsubtree; /** * Print hierarchical view of function calls */ printHierarchicalView(): void; /** * Get memory usage statistics */ getMemoryStats(): { [key: string]: MemoryUsage; }; /** * Get performance alerts */ getAlerts(): PerformanceAlert[]; /** * Get detected hotspots */ getHotspots(): Hotspot[]; /** * Get regression report */ getRegressionReport(): RegressionReport[]; /** * Clear all alerts */ clearAlerts(): void; /** * Reset all profiling data */ reset(): void; /** * Enable or disable profiling */ setEnabled(enabled: boolean): void; /** * Check if profiling is enabled */ isEnabled(): boolean; /** * Get current call stack (for debugging) */ getCallStack(): string[]; /** * Get all profiling entries */ getEntries(): Map; } export declare const profiler: Profiler; export {}; //# sourceMappingURL=profiler.d.ts.map