UNPKG

@casoon/auditmysite

Version:

Professional website analysis suite with robust accessibility testing, Core Web Vitals performance monitoring, SEO analysis, and content optimization insights. Features isolated browser contexts, retry mechanisms, and comprehensive API endpoints for profe

119 lines 3.07 kB
/** * Performance Monitoring and Benchmarking System */ export interface PerformanceMetrics { timestamp: number; operation: string; duration: number; memoryUsage: { used: number; total: number; external: number; heapUsed: number; heapTotal: number; }; cpuUsage?: { user: number; system: number; }; metadata?: Record<string, any>; } export interface BenchmarkResult { operation: string; iterations: number; totalTime: number; averageTime: number; minTime: number; maxTime: number; standardDeviation: number; throughput: number; memoryProfile: { initial: number; peak: number; final: number; leaked: number; }; } export declare class PerformanceMonitor { private metrics; private activeOperations; private benchmarks; /** * Start monitoring an operation */ startOperation(operationId: string, operation: string, metadata?: Record<string, any>): void; /** * End monitoring an operation and record metrics */ endOperation(operationId: string, operation: string, metadata?: Record<string, any>): PerformanceMetrics | null; /** * Monitor a function execution */ monitor<T>(operation: string, fn: () => Promise<T> | T, metadata?: Record<string, any>): Promise<T>; /** * Run benchmark tests */ benchmark(name: string, fn: () => Promise<any> | any, options?: { iterations?: number; warmup?: number; }): Promise<BenchmarkResult>; /** * Get performance statistics */ getStats(operation?: string): { count: number; averageDuration: number; totalDuration: number; minDuration: number; maxDuration: number; averageMemoryUsage: number; peakMemoryUsage: number; }; /** * Get all metrics */ getMetrics(limit?: number): PerformanceMetrics[]; /** * Get all benchmarks */ getBenchmarks(): Map<string, BenchmarkResult>; /** * Generate performance report */ generateReport(): string; /** * Clear all metrics and benchmarks */ clear(): void; /** * Export metrics to JSON */ export(): { metrics: PerformanceMetrics[]; benchmarks: Record<string, BenchmarkResult>; stats: { count: number; averageDuration: number; totalDuration: number; minDuration: number; maxDuration: number; averageMemoryUsage: number; peakMemoryUsage: number; }; timestamp: number; }; /** * Format bytes to human readable format */ private formatBytes; /** * Memory leak detection */ detectMemoryLeaks(threshold?: number): { hasLeak: boolean; leakSize: number; operations: string[]; }; } export declare const performanceMonitor: PerformanceMonitor; //# sourceMappingURL=performance-monitor.d.ts.map