@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
108 lines (107 loc) • 5.02 kB
TypeScript
import { BaseModel } from './BaseModel';
import { ModelMap } from './ModelMap';
import { SourceNodeMetaData } from './SourceNodeMetaData';
import { SensorValues } from './SensorValues';
import { SourceNodeGraph } from './SourceNodeGraph';
import { PathIndex } from './indices/PathIndex';
import { GlobalIndex } from './indices/GlobalIndex';
import { SourceNodeIndex } from './indices/SourceNodeIndex';
import { LangInternalPath_string, SourceNodeIdentifier_string, UnifiedPath_string, PathID_number, SourceNodeID_number, IndexRequestType, SourceNodeIndexType, SourceNodeMetaDataType, ISourceFileMetaData, IAggregatedSourceNodeMetaData } from '../types';
export declare class AggregatedSourceNodeMetaData extends BaseModel {
total: SourceNodeMetaData<SourceNodeMetaDataType.Aggregate>;
max: SourceNodeMetaData<SourceNodeMetaDataType.Aggregate>;
constructor(total: SourceNodeMetaData<SourceNodeMetaDataType.Aggregate>, max: SourceNodeMetaData<SourceNodeMetaDataType.Aggregate>);
toBuffer(): Buffer;
toJSON(): IAggregatedSourceNodeMetaData;
static join(...args: AggregatedSourceNodeMetaData[]): AggregatedSourceNodeMetaData;
static fromJSON(json: string | IAggregatedSourceNodeMetaData): AggregatedSourceNodeMetaData;
}
export declare class SourceFileMetaData extends BaseModel {
path: UnifiedPath_string | LangInternalPath_string;
private _functions?;
pathIndex: PathIndex;
constructor(path: UnifiedPath_string | LangInternalPath_string, pathIndex: PathIndex);
get containsUncommittedChanges(): boolean;
set containsUncommittedChanges(v: boolean);
normalize(newGlobalIndex: GlobalIndex): void;
static merge(pathIndex: PathIndex, ...args: SourceFileMetaData[]): SourceFileMetaData;
get functions(): ModelMap<SourceNodeID_number, SourceNodeMetaData<SourceNodeMetaDataType.SourceNode | SourceNodeMetaDataType.LangInternalSourceNode>>;
getSourceNodeIndexByID(id: SourceNodeID_number): SourceNodeIndex<SourceNodeIndexType.SourceNode> | undefined;
getSourceNodeIndex<T extends IndexRequestType>(indexRequestType: T, sourceNodeIdentifier: SourceNodeIdentifier_string): T extends "upsert" ? SourceNodeIndex<SourceNodeIndexType.SourceNode> : SourceNodeIndex<SourceNodeIndexType.SourceNode> | undefined;
validate(): void;
toJSON(): ISourceFileMetaData;
static fromJSON(json: string | ISourceFileMetaData, pathIndex: PathIndex): SourceFileMetaData;
createOrGetSourceNodeMetaData<T extends SourceNodeMetaDataType.SourceNode | SourceNodeMetaDataType.LangInternalSourceNode>(identifier: SourceNodeIdentifier_string, type: T): SourceNodeMetaData<T>;
/**
* Calculates the total SourceNodeMetaData of the SourceFile (the sum of all functions)
* as well as the intern, extern and langInternal references.
*
* TLDR:
* Returns the total sum of the measurements of the file and each external reference (not included in that file)
* with their own sum of measurements.
*
*
* Example:
*
* // File: FileA
* ClassA:
* functionA:
* selfTime: 1
* aggregatedTime: 6
* intern:
* ClassA.functionB:
* aggregatedTime: 5
* functionB:
* selfTime: 2
* aggregatedTime: 5
* intern:
* ClassA.functionC:
* aggregatedTime: 3
* functionC:
* selfTime: 2
* aggregatedTime: 3
* intern:
* ClassB.functionD:
* aggregatedTime: 1
*
* // File: FileB
* ClassB:
* functionD:
* selfTime: 1
* aggregatedTime: 1
*
*
* Would return:
*
* sum: { selfTime: 5, aggregatedTime: 6, internCPUTime: 1 }
* intern:
* ClassB.functionD:
* aggregatedCPUTime: 1
* extern: empty
* langInternal: empty
*
* For each function in the file the sum is calculated by adding up:
* hits, selfTime, aggregatedTime, langInternalTime, externTime and internTime
*
* Then intern self references within the same file are removed from the sum
*
* @returns {
* sum // the sum of all functions in the file
* intern // the sum of all intern references of each function in the file
* extern // the sum of all extern references of each function in the file
* langInternal // the sum of all langInternal references of each function in the file
* }
*/
totalSourceNodeMetaData(graph: SourceNodeGraph): {
sum: SourceNodeMetaData<SourceNodeMetaDataType.Aggregate>;
intern: ModelMap<PathID_number, SensorValues>;
extern: ModelMap<PathID_number, SensorValues>;
langInternal: ModelMap<PathID_number, SensorValues>;
};
maxSourceNodeMetaData(): SourceNodeMetaData<SourceNodeMetaDataType.Aggregate>;
toBuffer(): Buffer<ArrayBuffer>;
static consumeFromBuffer(buffer: Buffer, globalIndex: GlobalIndex): {
instance: SourceFileMetaData;
remainingBuffer: Buffer;
};
}