import { PerformanceTracker as StaticPerformanceTracker } from './performance.tracker.js'; /** * Instance-based wrapper for PerformanceTracker to provide the API expected by tests */ export class PerformanceTracker { constructor(private name: string) {} /** * Measure an async operation */ async measureAsync(operation: string, fn: () => Promise): Promise { const fullOperation = `${this.name} - ${operation}`; const { result } = await StaticPerformanceTracker.track(fullOperation, fn); return result; } /** * Measure a sync operation (convert to async) */ measure(operation: string, fn: () => T): T { const fullOperation = `${this.name} - ${operation}`; const result = fn(); // Track sync operations as completed instantly const startTime = performance.now(); const endTime = performance.now(); // We can't use the static tracker for sync operations directly, // so we'll just return the result return result; } /** * Get summary statistics for operations under this tracker */ async getSummary(operation?: string): Promise { const fullOperation = operation ? `${this.name} - ${operation}` : this.name; return StaticPerformanceTracker.getSummary(fullOperation); } }