Skip to main content
Dotset CLI API Documentation / index / Profiler

Class: Profiler

Defined in: src/mantle/utils/profiler.ts:200 Main profiler for collecting performance metrics

Constructors

Constructor

new Profiler(options): Profiler;
Defined in: src/mantle/utils/profiler.ts:212

Parameters

options
ProfilerOptions = {}

Returns

Profiler

Methods

formatReport()

formatReport(): string;
Defined in: src/mantle/utils/profiler.ts:417 Format report as human-readable string

Returns

string

generateReport()

generateReport(): ProfileReport;
Defined in: src/mantle/utils/profiler.ts:361 Generate a complete profile report

Returns

getAllOperationStats()

getAllOperationStats(): OperationStats[];
Defined in: src/mantle/utils/profiler.ts:338 Get all operation statistics

Returns

OperationStats[]

getOperationStats()

getOperationStats(operation): OperationStats | undefined;
Defined in: src/mantle/utils/profiler.ts:313 Get statistics for a specific operation

Parameters

operation
string

Returns

OperationStats | undefined

getPeakMemory()

getPeakMemory(): MemorySnapshot | null;
Defined in: src/mantle/utils/profiler.ts:350 Get peak memory usage

Returns

MemorySnapshot | null

recordTiming()

recordTiming(operation, durationMs): void;
Defined in: src/mantle/utils/profiler.ts:225 Record a timing measurement

Parameters

operation
string
durationMs
number

Returns

void

reset()

reset(): void;
Defined in: src/mantle/utils/profiler.ts:464 Reset all collected metrics

Returns

void

startTimer()

startTimer(operation, metadata?): Timer;
Defined in: src/mantle/utils/profiler.ts:253 Create a timer that auto-records to this profiler

Parameters

operation
string
metadata?
Record<string, unknown>

Returns

stop()

stop(): void;
Defined in: src/mantle/utils/profiler.ts:475 Stop the profiler and memory sampling

Returns

void

takeMemorySnapshot()

takeMemorySnapshot(): MemorySnapshot;
Defined in: src/mantle/utils/profiler.ts:292 Take a memory snapshot

Returns

timeAsync()

timeAsync<T>(operation, fn): Promise<{
  durationMs: number;
  result: T;
}>;
Defined in: src/mantle/utils/profiler.ts:272 Time an async operation with automatic recording

Type Parameters

T
T

Parameters

operation
string
fn
() => Promise<T>

Returns

Promise<{ durationMs: number; result: T; }>

timeSync()

timeSync<T>(operation, fn): {
  durationMs: number;
  result: T;
};
Defined in: src/mantle/utils/profiler.ts:282 Time a sync operation with automatic recording

Type Parameters

T
T

Parameters

operation
string
fn
() => T

Returns

{
  durationMs: number;
  result: T;
}
durationMs
durationMs: number;
result
result: T;