/** * Shared Timing Utilities * * Provides common timing and performance measurement patterns * to reduce duplication across the qtests codebase. */ export interface TimingResult { startTime: number; endTime: number; duration: number; formattedDuration: string; } export interface PerformanceMetrics { operation: string; duration: number; threshold: number; status: 'fast' | 'normal' | 'slow' | 'critical'; recommendations: string[]; } /** * Create a timing measurement utility */ export declare class Timer { private startTime; private endTime; private operation; constructor(operation?: string); /** * Start timing */ start(): void; /** * Stop timing and return result */ stop(): TimingResult; /** * Stop timing and log result */ stopAndLog(): TimingResult; /** * Get current elapsed time without stopping */ elapsed(): number; /** * Get formatted elapsed time */ elapsedFormatted(): string; /** * Format duration in human readable format */ private formatDuration; } /** * Measure execution time of a synchronous function */ export declare function measureTime(fn: () => T, operation?: string): { result: T; timing: TimingResult; }; /** * Measure execution time of an asynchronous function */ export declare function measureAsyncTime(fn: () => Promise, operation?: string): Promise<{ result: T; timing: TimingResult; }>; /** * Measure time with automatic performance analysis */ export declare function measureWithAnalysis(fn: () => T, operation: string, thresholds?: { fast?: number; normal?: number; slow?: number; }): { result: T; timing: TimingResult; metrics: PerformanceMetrics; }; /** * Measure async time with automatic performance analysis */ export declare function measureAsyncWithAnalysis(fn: () => Promise, operation: string, thresholds?: { fast?: number; normal?: number; slow?: number; }): Promise<{ result: T; timing: TimingResult; metrics: PerformanceMetrics; }>; /** * Analyze performance metrics */ export declare function analyzePerformance(operation: string, duration: number, thresholds?: { fast?: number; normal?: number; slow?: number; }): PerformanceMetrics; /** * Performance tracking utility */ export declare class PerformanceTracker { private measurements; private maxMeasurements; constructor(maxMeasurements?: number); /** * Record a performance measurement */ record(operation: string, duration: number): void; /** * Get statistics for a specific operation */ getStats(operation: string): { count: number; avgDuration: number; minDuration: number; maxDuration: number; totalDuration: number; } | null; /** * Get overall performance summary */ getSummary(): { totalOperations: number; totalDuration: number; avgDuration: number; slowestOperation: { operation: string; duration: number; } | null; fastestOperation: { operation: string; duration: number; } | null; }; /** * Clear all measurements */ clear(): void; /** * Print performance summary */ printSummary(): void; } export declare const globalPerformanceTracker: PerformanceTracker; /** * Higher-order function to wrap functions with timing */ export declare function withTiming any>(fn: T, operation?: string): T; //# sourceMappingURL=timingUtils.d.ts.map