@oaklean/profiler
Version:
A library to measure the energy consumption of your javascript/typescript code
30 lines (29 loc) • 1.09 kB
TypeScript
import { MicroSeconds_number } from '@oaklean/profiler-core';
export declare class TraceEventHelper {
private static _started;
private static _profilerStartTime;
/**
* Starts a trace event session to capture V8 trace events.
*/
private static startTraceEventSession;
private static post;
/**
* Handles the 'dataCollected' event from the NodeTracing domain.
* @param chunk - The data chunk containing trace event information.
*/
private static onDataCollected;
/**
* Starts capturing trace events related to CPU profiling.
*/
static startCapturingProfilerTracingEvents(): Promise<void>;
/**
* Stops capturing trace events related to CPU profiling.
*/
static stopTraceEventSession(): Promise<void>;
/**
* Retrieves the high-resolution timestamp when CPU profiling began.
* @returns The high-resolution timestamp in microseconds.
* @throws Error if the start time could not be captured after multiple attempts.
*/
static getCPUProfilerBeginTime(): Promise<MicroSeconds_number>;
}