@oaklean/profiler-core
Version:
Part of the @oaklean suite. It provides all basic functions to work with the `.oak` file format. It allows parsing the `.oak` file format as well as tools for analyzing the measurement values. It also provides all necessary capabilities required for prec
52 lines (51 loc) • 1.58 kB
TypeScript
import { Protocol as Cdp } from 'devtools-protocol';
import { INode } from '../common/model';
import { ICpuProfileRaw } from './types';
/**
* One measured node in the call stack. Contains the time it spent in itself,
* the time all its children took, references to its children, and finally
* the ID of its location in the {@link IProfileModel.locations} array.
*/
export interface IComputedNode {
id: number;
selfTime: number;
aggregateTime: number;
children: number[];
parent?: number;
locationId: number;
}
/**
* One location in the source. Multiple nodes can reference a single location.
*/
export interface ILocation extends INode {
selfTime: number;
aggregateTime: number;
ticks: number;
callFrame: Cdp.Runtime.CallFrame;
}
export interface IGraphNode extends ILocation {
children: {
[id: number]: IGraphNode;
};
childrenSize: number;
parent?: IGraphNode;
}
/**
* Data model for the profile.
*
* Note that source locations and notes are seprate. This is needed because
* children in the profile are unique per the calls stack that invoked them,
* so the same source location will have multiple different nodes in the model.
*/
export interface IProfileModel {
nodes: ReadonlyArray<IComputedNode>;
locations: ReadonlyArray<ILocation>;
samples: ReadonlyArray<number>;
timeDeltas: ReadonlyArray<number>;
rootPath?: string;
duration: number;
}
/**
* Computes the model for the given profile.
*/
export declare const buildModel: (profile: ICpuProfileRaw) => IProfileModel;