Skip to main content

Profiler

Provides performance measurement tools (execution time, memory, ...).

class Profiler

Properties

  • startTimestamp: Profiling start timestamp.
  • startCpuAverageLoad: Profiling start average CPU load.
  • measurements: List of measurements for current profiling.

constructor

public constructor();

Description

Class constructor.


formatMetrics

public static formatMetrics(metrics: Measurement[]): string;

Description

Formats the given profiler metrics into a human-readable string.

Parameters

  • metrics: Profiler metrics.

Returns

Formatted metrics.


getCpuAverageLoad

public static getCpuAverageLoad(): CpuLoad;

Description

Computes current CPU average load. See CPU Load Calculation Gist.

Returns

Current CPU average load.


reset

public reset(): void;

Description

Resets profiling.


snapshot

public snapshot(name: string): void;

Description

Creates a snapshot of current performance metrics under the given name.

Parameters

  • name: Snapshot name.

getMetrics

public getMetrics(): Measurement[];

Description

Returns collected performance metrics for the current profiling session.

Returns

Collected metrics.