Create a new performance timer.
Human-readable name for the operation being timed
Logger instance for recording timing information
Debug level logging
Error level logging
Info level logging
Trace level logging
Warning level logging
Optionalcontext: Record<string, unknown>Optional context information to include in logs
PrivatecheckpointsList of checkpoints recorded during operation.
Memory snapshot at checkpoint
Checkpoint name
Time when checkpoint was recorded (milliseconds)
Private OptionalcontextOptional context information to include in logs
PrivateloggerLogger instance for recording timing information
Debug level logging
Error level logging
Info level logging
Trace level logging
Warning level logging
PrivateoperationHuman-readable name for the operation being timed
Private OptionalstartInitial memory snapshot.
Private OptionalstartStart time in milliseconds.
PrivatecalculatePrivateCalculate memory usage delta between two snapshots.
Starting memory snapshot
Ending memory snapshot
Memory delta with human-readable formatted values
PrivatecategorizePrivateCategorize performance based on duration in milliseconds.
Duration in milliseconds
Performance category: 'fast', 'normal', 'slow', or 'very_slow'
End the timer and log final results. Logs total duration, checkpoint summary, and memory delta. Resets the timer after logging.
Operation status: 'success', 'failure', or 'cancelled' (default: 'success')
void
PrivateformatPrivateFormat bytes into human-readable format with sign and unit.
Byte count to format
Formatted string with sign ('+' or '-'), value, and unit (B, KB, MB, GB)
PrivategetPrivateGet current memory usage snapshot.
Current process memory usage snapshot
Start the timer and initialize memory tracking. Must be called before using checkpoint() or end().
void
Manual performance timer for complex operations.