MCPcopy Index your code
hub / github.com/nodejs/node / end

Method end

benchmark/common.js:261–291  ·  view source on GitHub ↗
(operations)

Source from the content-addressed store, hash-verified

259 }
260
261 end(operations) {
262 // Get elapsed time now and do error checking later for accuracy.
263 const time = process.hrtime.bigint();
264
265 if (!this._started) {
266 throw new Error('called end without start');
267 }
268 if (this._ended) {
269 throw new Error('called end multiple times');
270 }
271 if (typeof operations !== 'number') {
272 throw new Error('called end() without specifying operation count');
273 }
274 if (!process.env.NODEJS_BENCHMARK_ZERO_ALLOWED && operations <= 0) {
275 throw new Error('called end() with operation count <= 0');
276 }
277
278 this._ended = true;
279
280 if (time === this._time) {
281 if (!process.env.NODEJS_BENCHMARK_ZERO_ALLOWED)
282 throw new Error('insufficient clock precision for short benchmark');
283 // Avoid dividing by zero
284 this.report(operations && Number.MAX_VALUE, 0n);
285 return;
286 }
287
288 const elapsed = time - this._time;
289 const rate = operations / (Number(elapsed) / 1e9);
290 this.report(rate, elapsed);
291 }
292
293 report(rate, elapsed) {
294 sendResult({

Callers 15

mainFunction · 0.45
mainFunction · 0.45
goFunction · 0.45
runFunction · 0.45
mainFunction · 0.45
goFunction · 0.45
mainFunction · 0.45
childProcessExecStdoutFunction · 0.45
measureFunction · 0.45
mainFunction · 0.45
AEAD_BenchFunction · 0.45
mainFunction · 0.45

Calls 1

reportMethod · 0.95

Tested by

no test coverage detected