/** * Performance Monitor * * Tracks and reports performance metrics for operations. * * @since v1.29.0 */ /** * Performance metric entry */ export interface PerformanceMetric { name: string; value: number; /** e.g. 'ms', 'bytes', 'units' */ unit: string; timestamp: number; } /** * Timer result */ export interface TimerResult { /** In milliseconds */ duration: number; startTime: number; endTime: number; } /** * Aggregated metrics */ export interface AggregatedMetrics { avg: number; min: number; max: number; count: number; sum: number; } /** * Performance report */ export interface PerformanceReport { /** Report generation time */ generatedAt: string; /** Metrics by name */ metrics: Record; /** Active timers */ activeTimers: string[]; /** Memory usage */ memory?: { heapUsed: number; heapTotal: number; external: number; rss: number; }; } /** * Performance monitor service */ export declare class PerformanceMonitor { private metrics; private timers; private maxSamples; constructor(options?: { maxSamples?: number; }); /** * Start a timer * @returns Function to stop the timer and get duration */ startTimer(name: string): () => TimerResult; /** * Time an async operation */ timeAsync(name: string, operation: () => Promise): Promise<{ result: T; duration: number; }>; /** * Time a sync operation */ timeSync(name: string, operation: () => T): { result: T; duration: number; }; /** * Check if a timer is running */ isTimerRunning(name: string): boolean; /** * Get elapsed time for a running timer */ getElapsed(name: string): number | null; /** * Record a metric */ recordMetric(name: string, value: number, unit?: string): void; /** * Get metrics for a name */ getMetrics(name: string): PerformanceMetric[]; /** * Get aggregated metrics for a name */ getAggregated(name: string): AggregatedMetrics | null; /** * Get all metric names */ getMetricNames(): string[]; /** * Get a full performance report */ getReport(): PerformanceReport; /** * Get a formatted report string */ getFormattedReport(): string; /** * Clear all metrics */ clearMetrics(): void; /** * Clear metrics for a specific name */ clearMetric(name: string): void; /** * Reset the monitor */ reset(): void; } /** * Get the singleton performance monitor */ export declare function getPerformanceMonitor(): PerformanceMonitor; /** * Reset the singleton (for testing) */ export declare function resetPerformanceMonitor(): void; //# sourceMappingURL=performance-monitor.d.ts.map