UNPKG

@oaklean/profiler

Version:

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

37 lines (36 loc) 1.4 kB
import { MetricsDataCollection, IPowerMetricsSensorInterfaceOptions, NanoSeconds_BigInt, SensorInterfaceType } from '@oaklean/profiler-core'; import { BaseSensorInterface } from '../BaseSensorInterface'; /** * This SensorInterface uses the data provided by the powermetrics command line tool. * This SensorInterface can only be used on Mac OS * * Man Page to powermetrics: * https://www.unix.com/man-page/osx/1/powermetrics/ */ export declare class PowerMetricsSensorInterface extends BaseSensorInterface { private _executable; private _options; private _commandLineArgs; private _childProcess; private _startTime; private _stopTime; private _platform; private _eventHandler; private cleanExit; private _fileWatcher; constructor(options: IPowerMetricsSensorInterfaceOptions, debugOptions?: { startTime: NanoSeconds_BigInt; stopTime: NanoSeconds_BigInt; platform?: 'darwin'; }); type(): SensorInterfaceType; canBeExecuted(): Promise<boolean>; isRunning(): boolean; static runningInstances(): string[]; readSensorValues(pid: number): Promise<MetricsDataCollection | undefined>; get startTime(): NanoSeconds_BigInt | undefined; get stopTime(): NanoSeconds_BigInt | undefined; startProfiling(): Promise<void>; measurementStarted(): Promise<void>; stopProfiling(): Promise<void>; }