/** * A class to measure performance of code execution. * * This utility records elapsed time during execution and provides a detailed * breakdown of elapsed time between checkpoints. * * Usage example: * const timer = new PerformanceTimer(); * timer.checkpoint('Start Processing'); * // ... code for processing * timer.checkpoint('After Task 1'); * // ... additional processing code * timer.stop(); * console.log(timer.generateReport()); * * Methods: * - checkpoint(label: string): Record a timestamped checkpoint. * - stop(): Stop the timer and compute the total elapsed time. * - generateReport(): Return a performance report with total time and phases. * - formatPerformanceReport(): Return a formatted string of the performance report. * - getElapsedSeconds(): Get the current elapsed time in seconds. */ export declare class PerformanceTimer { private startTime; private checkpoints; private totalTime; constructor(); /** * Gets the current elapsed time in seconds. * * @returns The elapsed time in seconds with 3 decimal places of precision. */ getElapsedSeconds(): number; /** * Records a checkpoint with the given label. * * @param label - A descriptive label for the checkpoint. */ checkpoint(label: string): void; /** * Stops the timer and sets the total elapsed time. */ stop(): void; /** * Generates a performance report containing the total elapsed time and * breakdown of phases between checkpoints. * * @returns A performance report object. * @throws Error if the timer is not stopped before generating the report. */ analyseReportData(): PerformanceReport; /** * Returns a formatted string of the performance report. * * @returns A string detailing the total execution time and phase breakdown. */ generateReport(): string; } /** * Interface representing a single phase of performance measurement. */ export interface PerformancePhase { label: string; duration: number; } /** * Interface representing the full performance report. */ export interface PerformanceReport { totalTime: number; phases: PerformancePhase[]; }