MCPcopy
hub / github.com/webpack/webpack / stopProfiling

Method stopProfiling

lib/debug/ProfilingPlugin.js:141–160  ·  view source on GitHub ↗

* Returns }>} profile result. * @returns {Promise<{ profile: { startTime: number, endTime: number } }>} profile result

()

Source from the content-addressed store, hash-verified

139 * @returns {Promise<{ profile: { startTime: number, endTime: number } }>} profile result
140 */
141 stopProfiling() {
142 return this.sendCommand("Profiler.stop").then(({ profile }) => {
143 const hrtime = process.hrtime();
144 const endTime = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000);
145 // Avoid coverage problems due indirect changes
146 /* istanbul ignore next */
147 if (profile.startTime < this._startTime || profile.endTime > endTime) {
148 // In some cases timestamps mismatch and we need to adjust them
149 // Both process.hrtime and the inspector timestamps claim to be relative
150 // to a unknown point in time. But they do not guarantee that this is the
151 // same point in time.
152 const duration = profile.endTime - profile.startTime;
153 const ownDuration = endTime - this._startTime;
154 const untracked = Math.max(0, ownDuration - duration);
155 profile.startTime = this._startTime + untracked / 2;
156 profile.endTime = endTime - untracked / 2;
157 }
158 return { profile };
159 });
160 }
161}
162
163/**

Callers 1

applyMethod · 0.80

Calls 1

sendCommandMethod · 0.95

Tested by

no test coverage detected