UNPKG

@oaklean/profiler

Version:

A library to measure the energy consumption of your javascript/typescript code

36 lines (35 loc) 1.87 kB
import { UnifiedPath, ProfilerConfig, ProjectReport, IProjectReportExecutionDetails, NanoSeconds_BigInt, MicroSeconds_number } from '@oaklean/profiler-core'; import { JestEnvironmentConfig, EnvironmentContext } from '@jest/environment'; import { PowerMetricsSensorInterface } from './interfaces/powermetrics/PowerMetricsSensorInterface'; import { PerfSensorInterface } from './interfaces/perf/PerfSensorInterface'; import { WindowsSensorInterface } from './interfaces/windows/WindowsSensorInterface'; export type TransformerAdapter = 'ts-jest'; export type ProfilerOptions = { transformerAdapter?: TransformerAdapter; jestAdapter: { config: JestEnvironmentConfig; context: EnvironmentContext; }; }; export declare class Profiler { subOutputDir: string | undefined; config: ProfilerConfig; options?: ProfilerOptions; executionDetails?: IProjectReportExecutionDetails; private _sensorInterface; private _traceEventSession; private _profilerStartTime; constructor(subOutputDir?: string, options?: ProfilerOptions); static getSensorInterface(config: ProfilerConfig): PowerMetricsSensorInterface | PerfSensorInterface | WindowsSensorInterface | undefined; loadSensorInterface(): void; static inject(subOutputDir?: string): Promise<Profiler>; startCapturingProfilerTracingEvents(): Promise<void>; stopCapturingProfilerTracingEvents(): Promise<void>; getCPUProfilerBeginTime(): Promise<MicroSeconds_number>; start(title: string, executionDetails?: IProjectReportExecutionDetails): Promise<void>; outputDir(): UnifiedPath; outputReportPath(title: string): UnifiedPath; outputMetricCollectionPath(title: string): UnifiedPath; outputProfilePath(title: string): UnifiedPath; finish(title: string, highResolutionStopTime?: NanoSeconds_BigInt): Promise<ProjectReport>; }