UNPKG

@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

80 lines (79 loc) 4.31 kB
import { CallRelationTracker } from './CallRelationTracker'; import { State } from './types/state'; import { ToLangInternalTransition, ToProjectTransition, ToModuleTransition } from './types/transition'; import { AccountingInfo } from './types/accounting'; import { AwaiterStack } from './types/stack'; import { CPUNode } from '../CPUProfile/CPUNode'; import { ProjectReport } from '../../model/ProjectReport'; import { ISensorValues, SourceNodeMetaDataType } from '../../types'; export declare class AccountingHelper { static sensorValuesForVisitedNode(sensorValues: ISensorValues, visited: boolean): ISensorValues; /** * This method creates a new source node (if it does not exist) * in the [lang internal] section of the current report. * And adds the sensor values of the cpu node to the new source node. * * It also handles the linking of the newly created source node to the current source node. * * @param cpuNode the new cpu node (that should be inserted) * @param transition the transition (by inserting the cpu node) * * @returns the new state */ static accountToLangInternal(currentState: State, cpuNode: CPUNode, transition: ToLangInternalTransition, callRelationTracker: CallRelationTracker): Promise<{ nextState: State; accountingInfo: AccountingInfo<SourceNodeMetaDataType.LangInternalSourceNode, SourceNodeMetaDataType.LangInternalSourceNodeReference>; }>; /** * This method creates a new source node (if it does not exist) * in the [intern] section of the current report. * And adds the sensor values of the cpu node to the new source node. * * It also handles the linking of the newly created source node to the current source node. * * @param cpuNode the new cpu node (that should be inserted) * @param transition the transition (by inserting the cpu node) * * @returns the new state */ static accountToIntern(currentState: State, cpuNode: CPUNode, transition: ToProjectTransition | ToModuleTransition, callRelationTracker: CallRelationTracker, awaiterStack: AwaiterStack): Promise<{ nextState: State; accountingInfo: AccountingInfo<SourceNodeMetaDataType.SourceNode, SourceNodeMetaDataType.InternSourceNodeReference>; }>; /** * This method creates a new source node and node module (if it does not exist) in the current report * in the [extern] section of the current report. * And adds the sensor values of the cpu node to the new source node. * * It also handles the linking of the newly created source node to the current source node. * * @param cpuNode the new cpu node (that should be inserted) * @param transition the transition (by inserting the cpu node) * * @returns the new state */ static accountToExtern(currentState: State, cpuNode: CPUNode, transition: ToModuleTransition, callRelationTracker: CallRelationTracker): Promise<{ nextState: State; accountingInfo: AccountingInfo<SourceNodeMetaDataType.SourceNode, SourceNodeMetaDataType.ExternSourceNodeReference>; }>; /** * This method is called when the new cpu node belongs to the project source code * but was executed by an external function (module or wasm). * * It creates a new source node (if it does not exist) in the [intern] section of the current report. * And adds the sensor values of the cpu node to the new source node. * * It does NOT create a link to the parent, since the parent call is from a different report. * Since Wasm code is treated as external code, it has its own report. * * @param originalReport the original report where the cpu profile is inserted * @param cpuNode the new cpu node (that should be inserted) * @param transition the transition (by inserting the cpu node) * * @returns the new state */ static accountOwnCodeGetsExecutedByExternal(currentState: State, cpuNode: CPUNode, transition: ToProjectTransition, callRelationTracker: CallRelationTracker, originalReport: ProjectReport): Promise<{ nextState: State; accountingInfo: AccountingInfo<SourceNodeMetaDataType.SourceNode, SourceNodeMetaDataType.InternSourceNodeReference>; }>; }