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

    Performance monitoring utilities for tracking operation timing and memory usage.

    Index

    Constructors

    Accessors

    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'

    • Create a performance timer that can be manually controlled. Useful for tracking operations that span multiple function calls.

      Parameters

      • operationName: string

        Human-readable name for the operation

      • Optionalcontext: Record<string, unknown>

        Additional context information

      Returns PerformanceTimer

      PerformanceTimer instance

      const timer = PerformanceLogger.createTimer("multi_step_operation", { userId: "123" });
      timer.start();
      // ... do some work
      timer.checkpoint("step_1_complete");
      // ... do more work
      timer.end("success");
    • 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)

    • Track operation performance with automatic logging and memory monitoring. Logs start, completion, and failure with detailed performance metrics.

      Type Parameters

      • T

      Parameters

      • operationName: string

        Human-readable name for the operation

      • operation: () => Promise<T>

        Async function to execute and monitor

      • Optionalcontext: Record<string, unknown>

        Additional context information

      Returns Promise<T>

      Promise that resolves with the operation result

      const result = await PerformanceLogger.trackOperation(
      "notebook_save",
      () => saveNotebook(notebook),
      { notebookId: notebook.id, cellCount: notebook.cells.length }
      );
    • Track synchronous operation performance. For operations that don't return promises but still need timing.

      Type Parameters

      • T

      Parameters

      • operationName: string

        Human-readable name for the operation

      • operation: () => T

        Synchronous function to execute and monitor

      • Optionalcontext: Record<string, unknown>

        Additional context information

      Returns T

      The operation result