UNPKG

@lynx-js/web-core

Version:

This is an internal experimental package, do not use

47 lines 1.86 kB
// Copyright 2023 The Lynx Authors. All rights reserved. // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. export function createPerformanceApis(timingSystem) { let inc = 0; const performanceApis = { generatePipelineOptions: () => { const newPipelineId = `_pipeline_` + (inc++); return { pipelineID: newPipelineId, needTimestamps: false, }; }, onPipelineStart: function () { // Do nothing }, markPipelineTiming: function (pipelineId, timingKey) { timingSystem.markTimingInternal(timingKey, pipelineId); }, bindPipelineIdWithTimingFlag: function (pipelineId, timingFlag) { if (!timingSystem.pipelineIdToTimingFlags.has(pipelineId)) { timingSystem.pipelineIdToTimingFlags.set(pipelineId, []); } const timingFlags = timingSystem.pipelineIdToTimingFlags.get(pipelineId); timingFlags.push(timingFlag); }, profileStart: () => { console.error('NYI: profileStart. This is an issue of lynx-core.'); }, profileEnd: () => { console.error('NYI: profileEnd. This is an issue of lynx-core.'); }, profileMark: () => { console.error('NYI: profileMark. This is an issue of lynx-core.'); }, profileFlowId: () => { console.error('NYI: profileFlowId. This is an issue of lynx-core.'); return 0; }, isProfileRecording: () => { console.error('NYI: isProfileRecording. This is an issue of lynx-core.'); return false; }, }; return performanceApis; } //# sourceMappingURL=createPerformanceApis.js.map