@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
115 lines (114 loc) • 4.48 kB
TypeScript
import { CallIdentifier } from './CallIdentifier';
type MapEntry = {
children: string[];
linkCountToChild: Map<string, number>;
};
export declare class CallRelationTracker {
/**
* Tracks the relations between function calls.
*
* _map - Maps a function call to its child calls.
* parentCallIdentifier -> {
* children: [childCallIdentifier1, childCallIdentifier2, ...],
* perChild: {
* childCallIdentifier1 -> number, // number of links between parent and child
* childCallIdentifier2 -> number, // number of links between parent and child
* ...
* }
*/
private _map;
private _internMap;
private _externMap;
private _langInternalMap;
private _compensationLayerSet;
constructor();
get map(): Map<string, MapEntry>;
/**
* Check if the tracker is empty
*
* @returns {boolean} true if the tracker is empty, false otherwise
*/
isEmpty(): boolean;
/**
* Check if the tracker is currently in a headless scope.
* Meaning that no intern or extern calls were made yet.
*/
currentlyInHeadlessScope(): boolean;
/**
* Returns debug information about the tracker.
*
* @returns {object} debug information about the tracker
*/
debugInfo(): {
mapSize: number;
internMapSize: number;
externMapSize: number;
langInternalMapSize: number;
};
/**
* Remove the last child record from a call.
* Is used to remove the last child from a parent call after the child has been traversed.
*
* @param {CallIdentifier} callIdentifier - The call identifier
* @returns {boolean} true if the child was removed, false otherwise
*/
removeLastChildRecord(callIdentifier: CallIdentifier): boolean;
/**
* Checks if a function call has child calls recorded (used in recursion tracking).
*
* @param {CallIdentifier} callIdentifier - The call identifier
* @returns {boolean} true if the call identifier was already visited, false otherwise
*/
isCallRecorded(callIdentifier: CallIdentifier): boolean;
/**
* Gives the amount of recorded child calls for a function call.
*
* @param {CallIdentifier} callIdentifier - The call identifier
* @returns {number} the number of child calls
*/
getNumberOfChildren(callIdentifier: CallIdentifier): number;
/**
* Gives the amount of recorded links between two function calls.
*
* @param {CallIdentifier} parentCallIdentifier - the caller's call identifier
* @param {CallIdentifier} childCallIdentifier - the callee's call identifier
* @returns {number} the number of links between the two calls
*/
getNumberOfLinksBetweenCalls(parentCallIdentifier: CallIdentifier, childCallIdentifier: CallIdentifier): number;
/**
* Removes all references to a function call (for cleanup).
*
* @param {CallIdentifier} callIdentifier - The call identifier
*/
removeCallRecord(callIdentifier: CallIdentifier): void;
/**
* Ensures that the function call is tracked in the compensation layer.
*
* @param {CallIdentifier} callIdentifier - The call identifier
* @returns {boolean} true: first time in this compensation layer, false: already present
*/
initializeInCompensationLayerIfAbsent(callIdentifier: CallIdentifier): boolean;
/**
* Removes a function call from a specific compensation layer.
*
* @param {CallIdentifier} callIdentifier - The call identifier
*/
removeCompensationLayerRecord(callIdentifier: CallIdentifier): void;
/**
* Ensures that a function call entry exists in the tracker.
*
* @param {CallIdentifier} callIdentifier - The call identifier
* @param {string} kind - The kind of the call (intern, extern, langInternal)
* @returns {boolean} true if the call was initialized, false if it was already present
*/
initializeCallNodeIfAbsent(callIdentifier: CallIdentifier, kind: 'intern' | 'extern' | 'langInternal'): boolean;
/**
* Registers a function call as a child of another call.
*
* @param {CallIdentifier} self - The call identifier of the child call
* @param {CallIdentifier} parent - The call identifier of the parent call
* @returns wether the link already existed
*/
linkCallToParent(self: CallIdentifier, parent: CallIdentifier): boolean;
}
export {};