/** * Performance Profiler * * Tracks operation timing, memory usage, and identifies bottlenecks. */ export interface ProfileEntry { name: string; startTime: number; endTime?: number; duration?: number; memoryBefore?: number; memoryAfter?: number; memoryDelta?: number; metadata?: Record; } export interface ProfilerOptions { enabled?: boolean; trackMemory?: boolean; autoReport?: boolean; reportThresholdMs?: number; } export declare class Profiler { private entries; private completed; private options; constructor(options?: ProfilerOptions); /** * Start profiling an operation */ start(name: string, metadata?: Record): void; /** * End profiling an operation */ end(name: string): ProfileEntry | undefined; /** * Profile a synchronous function */ profile(name: string, fn: () => T, metadata?: Record): T; /** * Profile an async function */ profileAsync(name: string, fn: () => Promise, metadata?: Record): Promise; /** * Get all completed entries */ getEntries(): ProfileEntry[]; /** * Get entries matching filter */ getEntriesBy(filter: (entry: ProfileEntry) => boolean): ProfileEntry[]; /** * Get slowest operations */ getSlowest(n?: number): ProfileEntry[]; /** * Get operations by name */ getByName(name: string): ProfileEntry[]; /** * Get average duration for operation */ getAverageDuration(name: string): number; /** * Get statistics for operation */ getStats(name: string): { count: number; avg: number; min: number; max: number; total: number; } | null; /** * Get current memory usage in MB */ private getMemoryUsage; /** * Format entry as string */ private formatEntry; /** * Clear all entries */ clear(): void; /** * Generate report */ generateReport(): string; /** * Enable/disable profiler */ setEnabled(enabled: boolean): void; /** * Check if profiler is enabled */ isEnabled(): boolean; } /** * Global profiler instance */ export declare const profiler: Profiler; /** * Decorator for profiling methods */ export declare function Profile(name?: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor; //# sourceMappingURL=profiler.d.ts.map