1 line
52 KiB
Plaintext
1 line
52 KiB
Plaintext
|
{"version":3,"file":"hermes-profile-transformer.cjs.development.js","sources":["../src/types/Phases.ts","../src/profiler/cpuProfilerModel.ts","../node_modules/babel-plugin-transform-async-to-promises/helpers.js","../src/utils/fileSystem.ts","../src/profiler/applySourceMapsToEvents.ts","../src/index.ts"],"sourcesContent":["export enum EventsPhase {\n DURATION_EVENTS_BEGIN = 'B',\n DURATION_EVENTS_END = 'E',\n COMPLETE_EVENTS = 'X',\n INSTANT_EVENTS = 'I',\n COUNTER_EVENTS = 'C',\n ASYNC_EVENTS_NESTABLE_START = 'b',\n ASYNC_EVENTS_NESTABLE_INSTANT = 'n',\n ASYNC_EVENTS_NESTABLE_END = 'e',\n FLOW_EVENTS_START = 's',\n FLOW_EVENTS_STEP = 't',\n FLOW_EVENTS_END = 'f',\n SAMPLE_EVENTS = 'P',\n OBJECT_EVENTS_CREATED = 'N',\n OBJECT_EVENTS_SNAPSHOT = 'O',\n OBJECT_EVENTS_DESTROYED = 'D',\n METADATA_EVENTS = 'M',\n MEMORY_DUMP_EVENTS_GLOBAL = 'V',\n MEMORY_DUMP_EVENTS_PROCESS = 'v',\n MARK_EVENTS = 'R',\n CLOCK_SYNC_EVENTS = 'c',\n CONTEXT_EVENTS_ENTER = '(',\n CONTEXT_EVENTS_LEAVE = ')',\n // Deprecated\n ASYNC_EVENTS_START = 'S',\n ASYNC_EVENTS_STEP_INTO = 'T',\n ASYNC_EVENTS_STEP_PAST = 'p',\n ASYNC_EVENTS_END = 'F',\n LINKED_ID_EVENTS = '=',\n}\n","/**\n * @license Copyright 2020 The Lighthouse Authors. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n *\n * MODIFICATION NOTICE:\n * This file is derived from `https://github.com/GoogleChrome/lighthouse/blob/0422daa9b1b8528dd8436860b153134bd0f959f1/lighthouse-core/lib/tracehouse/cpu-profile-model.js`\n * and has been modified by Saphal Patro (email: saphal1998@gmail.com)\n * The following changes have been made to the original file:\n * 1. Converted code to Typescript and defined necessary types\n * 2. Wrote a method @see collectProfileEvents to convert the Hermes Samples to Profile Chunks supported by Lighthouse Parser\n * 3. Modified @see constructNodes to work with the Hermes Samples and StackFrames\n */\n\n/**\n * @fileoverview\n *\n * This model converts the `Profile` and `ProfileChunk` mega trace events from the `disabled-by-default-v8.cpu_profiler`\n * category into B/E-style trace events that main-thread-tasks.js already knows how to parse into a task tree.\n *\n * The CPU profiler measures where time is being spent by sampling the stack (See https://www.jetbrains.com/help/profiler/Profiling_Guidelines__Choosing_the_Right_Profiling_Mode.html\n * for a generic description of the differences between tracing and sampling).\n *\n * A `Profile` event is a record of the stack that was being executed at different sample points in time.\n * It has a structure like this:\n *\n * nodes: [function A, function B, function C]\n * samples: [node with id 2, node with id 1, ...]\n * timeDeltas: [4125μs since last sample, 121μs since last sample, ...]\n *\n * Helpful prior art:\n * @see https://cs.chromium.org/chromium/src/third_party/devtools-frontend/src/front_end/sdk/CPUProfileDataModel.js?sq=package:chromium&g=0&l=42\n * @see https://github.com/v8/v8/blob/99ca333b0efba3236954b823101315aefeac51ab/tools/profile.js\n * @see https://github.com/jlfwong/speedscope/blob/9ed1eb192cb7e9dac43a5f25bd101af169dc654a/src/import/chrome.ts#L200\n */\n\nimport {\n CPUProfileChunk,\n CPUProfileChunkNode,\n CPUProfileChunker,\n} from '../types/CPUProfile';\nimport { DurationEvent } from '../types/EventInterfaces';\nimport {\n HermesCPUProfile,\n HermesSample,\n HermesStackFrame,\n} from '../types/HermesProfile';\nimport { EventsPhase } from '../types/Phases';\n\nexport class CpuProfilerModel {\n _profile: CPUProfileChunk;\n _nodesById: Map<number, CPUProfileChu
|