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

109 lines (108 loc) 6.56 kB
/// <reference types="node" /> import { BaseModel } from './BaseModel'; import { ModelMap } from './ModelMap'; import { NodeModule } from './NodeModule'; import { AggregatedSourceNodeMetaData, SourceFileMetaData } from './SourceFileMetaData'; import { SourceNodeMetaData } from './SourceNodeMetaData'; import { ProfilerConfig } from './ProfilerConfig'; import { SensorValues } from './SensorValues'; import { ModuleIndex } from './index/ModuleIndex'; import { GlobalIndex } from './index/GlobalIndex'; import { PathIndex } from './index/PathIndex'; import { UnifiedPath } from '../system/UnifiedPath'; import { LangInternalPath_string, LangInternalSourceNodeIdentifier_string, SourceNodeIdentifier_string, UnifiedPath_string, SourceNodeMetaDataType, ReportKind, NodeModuleIdentifier_string, IPureCPUTime, IPureCPUEnergyConsumption, IPureRAMEnergyConsumption, ModuleID_number, IndexRequestType, PathID_number, IReport, ReportType } from '../types'; export declare class Report extends BaseModel { reportVersion: string; kind: ReportKind; relativeRootDir?: UnifiedPath; private _internMapping?; private _lang_internalHeadlessSensorValues?; private _lang_internal?; private _intern?; private _extern?; internID: number; moduleIndex: ModuleIndex; constructor(moduleIndex: ModuleIndex, kind: ReportKind); normalize(newGlobalIndex: GlobalIndex): void; get lang_internalHeadlessSensorValues(): SensorValues; set lang_internalHeadlessSensorValues(value: SensorValues); get internMapping(): ModelMap<PathID_number, PathID_number>; get lang_internal(): ModelMap<PathID_number, SourceFileMetaData>; get intern(): ModelMap<PathID_number, SourceFileMetaData>; get extern(): ModelMap<ModuleID_number, ModuleReport>; get reversedInternMapping(): ModelMap<PathID_number, PathID_number>; getLangInternalPathIndex<T extends IndexRequestType, R = T extends 'upsert' ? PathIndex : PathIndex | undefined>(indexRequestType: T, filePath: LangInternalPath_string): R; getModuleIndexByID(id: ModuleID_number): ModuleIndex | undefined; getModuleIndex<T extends IndexRequestType, R = T extends 'upsert' ? ModuleIndex : ModuleIndex | undefined>(indexRequestType: T, moduleIdentifier: NodeModuleIdentifier_string): R; getPathIndexByID(id: PathID_number): PathIndex | undefined; getPathIndex<T extends IndexRequestType, R = T extends 'upsert' ? PathIndex : PathIndex | undefined>(indexRequestType: T, filePath: UnifiedPath_string): R; removeFromIntern(filePath: UnifiedPath_string | UnifiedPath_string[]): void; addSourceFileMapLink(compiledFilePath: UnifiedPath, sourceFilePath: UnifiedPath): void; addToLangInternal(filePath: LangInternalPath_string, functionIdentifier: LangInternalSourceNodeIdentifier_string): SourceNodeMetaData<SourceNodeMetaDataType.LangInternalSourceNode>; addSensorValuesToLangInternal(filePath: LangInternalPath_string, functionIdentifier: LangInternalSourceNodeIdentifier_string, { cpuTime, cpuEnergyConsumption, ramEnergyConsumption }: { cpuTime: IPureCPUTime; cpuEnergyConsumption: IPureCPUEnergyConsumption; ramEnergyConsumption: IPureRAMEnergyConsumption; }): SourceNodeMetaData<SourceNodeMetaDataType.LangInternalSourceNode>; addToIntern(filePath: UnifiedPath_string, functionIdentifier: SourceNodeIdentifier_string): SourceNodeMetaData<SourceNodeMetaDataType.SourceNode>; addSensorValuesToIntern(filePath: UnifiedPath_string, functionIdentifier: SourceNodeIdentifier_string, { cpuTime, cpuEnergyConsumption, ramEnergyConsumption }: { cpuTime: IPureCPUTime; cpuEnergyConsumption: IPureCPUEnergyConsumption; ramEnergyConsumption: IPureRAMEnergyConsumption; }): SourceNodeMetaData<SourceNodeMetaDataType.SourceNode>; addToExtern(filePath: UnifiedPath, nodeModule: NodeModule, functionIdentifier: SourceNodeIdentifier_string): { report: ModuleReport; sourceNodeMetaData: SourceNodeMetaData<SourceNodeMetaDataType.SourceNode>; }; addSensorValuesToExtern(filePath: UnifiedPath, nodeModule: NodeModule, functionIdentifier: SourceNodeIdentifier_string, { cpuTime, cpuEnergyConsumption, ramEnergyConsumption }: { cpuTime: IPureCPUTime; cpuEnergyConsumption: IPureCPUEnergyConsumption; ramEnergyConsumption: IPureRAMEnergyConsumption; }): { report: ModuleReport; sourceNodeMetaData: SourceNodeMetaData<SourceNodeMetaDataType.SourceNode>; }; /** * Returns the meta data of a file * * since a meta data file is anonymized (no absolute path is stored) * there is a total of three paths necessary to retrieve the correct meta data of a file * * this.relativeRootDir: * describes the location of the execution (relative to the meta data file) * * projectReportFilePath: * is the current location of the ProjectReport file * * relativeFilePath: * is the location of a measured source file, * relative to the execution path (this.relativeRootDir) * * All measurements are stored in this.lang_internal, this,intern and this,extern * the keys are the corresponding relativeFilePaths * * the absolute path of the measured source file is: * path.join(projectReportFilePath, this.relativeRootDir, relativeFilePath) * * therefore the relativeFilePath of the absolute one is: * const relativeFilePath = path.relative(path.join(projectReportFilePath, this.relativeRootDir), absoluteFilePath) * * @param projectReportFilePath is the current location of the ProjectReport file * @param absoluteFilePath is the absolute path of the measured source file * @returns the measurements of the given source file */ getMetaDataFromFile(projectReportFilePath: UnifiedPath, absoluteFilePath: UnifiedPath): SourceFileMetaData | undefined; totalAndMaxMetaData(): AggregatedSourceNodeMetaData; validate(): void; toJSON(): IReport; static fromJSONReport(json: string | IReport, moduleIndex: ModuleIndex): Report; storeToFileReport(filePath: UnifiedPath, kind: 'pretty-json' | 'json' | 'bin', type: ReportType, config?: ProfilerConfig): void; static merge(moduleIndex: ModuleIndex, ...args: Report[]): Report; toBuffer(type: ReportType): Buffer; static consumeFromBufferReport(buffer: Buffer, moduleIndex: ModuleIndex): { instance: Report; type: ReportType; remainingBuffer: Buffer; }; } import { ModuleReport } from './ModuleReport';