Datalayer VS Code Extension - v0.0.9
    Preparing search index...

    Manual performance timer for complex operations.

    Index

    Constructors

    • Create a new performance timer.

      Parameters

      • operationName: string

        Human-readable name for the operation being timed

      • logger: {
            debug: (msg: string, ctx?: Record<string, unknown>) => void;
            error: (msg: string, err?: Error, ctx?: Record<string, unknown>) => void;
            info: (msg: string, ctx?: Record<string, unknown>) => void;
            trace: (msg: string, ctx?: Record<string, unknown>) => void;
            warn: (msg: string, ctx?: Record<string, unknown>) => void;
        }

        Logger instance for recording timing information

        • debug: (msg: string, ctx?: Record<string, unknown>) => void

          Debug level logging

        • error: (msg: string, err?: Error, ctx?: Record<string, unknown>) => void

          Error level logging

        • info: (msg: string, ctx?: Record<string, unknown>) => void

          Info level logging

        • trace: (msg: string, ctx?: Record<string, unknown>) => void

          Trace level logging

        • warn: (msg: string, ctx?: Record<string, unknown>) => void

          Warning level logging

      • Optionalcontext: Record<string, unknown>

        Optional context information to include in logs

      Returns PerformanceTimer

    Properties

    checkpoints: { memory: MemorySnapshot; name: string; time: number }[] = []

    List of checkpoints recorded during operation.

    Type Declaration

    • memory: MemorySnapshot

      Memory snapshot at checkpoint

    • name: string

      Checkpoint name

    • time: number

      Time when checkpoint was recorded (milliseconds)

    context?: Record<string, unknown>

    Optional context information to include in logs

    logger: {
        debug: (msg: string, ctx?: Record<string, unknown>) => void;
        error: (msg: string, err?: Error, ctx?: Record<string, unknown>) => void;
        info: (msg: string, ctx?: Record<string, unknown>) => void;
        trace: (msg: string, ctx?: Record<string, unknown>) => void;
        warn: (msg: string, ctx?: Record<string, unknown>) => void;
    }

    Logger instance for recording timing information

    Type Declaration

    • debug: (msg: string, ctx?: Record<string, unknown>) => void

      Debug level logging

    • error: (msg: string, err?: Error, ctx?: Record<string, unknown>) => void

      Error level logging

    • info: (msg: string, ctx?: Record<string, unknown>) => void

      Info level logging

    • trace: (msg: string, ctx?: Record<string, unknown>) => void

      Trace level logging

    • warn: (msg: string, ctx?: Record<string, unknown>) => void

      Warning level logging

    operationName: string

    Human-readable name for the operation being timed

    startMemory?: MemorySnapshot

    Initial memory snapshot.

    startTime?: number

    Start time in milliseconds.

    Methods

    • Private

      Categorize performance based on duration in milliseconds.

      Parameters

      • durationMs: number

        Duration in milliseconds

      Returns string

      Performance category: 'fast', 'normal', 'slow', or 'very_slow'

    • Add a checkpoint with optional name. Records current time and memory snapshot.

      Parameters

      • Optionalname: string

        Optional name for the checkpoint

      Returns void

      void

      Error if timer has not been started

    • End the timer and log final results. Logs total duration, checkpoint summary, and memory delta. Resets the timer after logging.

      Parameters

      • status: "success" | "failure" | "cancelled" = "success"

        Operation status: 'success', 'failure', or 'cancelled' (default: 'success')

      Returns void

      void

      Error if timer has not been started

    • Private

      Format bytes into human-readable format with sign and unit.

      Parameters

      • bytes: number

        Byte count to format

      Returns string

      Formatted string with sign ('+' or '-'), value, and unit (B, KB, MB, GB)