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

Function measure

test/fixtures/snapshot/typescript.js:3768–3777  ·  view source on GitHub ↗

* Adds a performance measurement with the specified name. * * @param measureName The name of the performance measurement. * @param startMarkName The name of the starting mark. If not supplied, the point at which the * profiler was enabled is used. *

(measureName, startMarkName, endMarkName)

Source from the content-addressed store, hash-verified

3766 * used.
3767 */
3768 function measure(measureName, startMarkName, endMarkName) {
3769 var _a, _b;
3770 if (enabled) {
3771 var end = (_a = (endMarkName !== undefined ? marks.get(endMarkName) : undefined)) !== null && _a !== void 0 ? _a : ts.timestamp();
3772 var start = (_b = (startMarkName !== undefined ? marks.get(startMarkName) : undefined)) !== null && _b !== void 0 ? _b : timeorigin;
3773 var previousDuration = durations.get(measureName) || 0;
3774 durations.set(measureName, previousDuration + (end - start));
3775 performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.measure(measureName, startMarkName, endMarkName);
3776 }
3777 }
3778 performance.measure = measure;
3779 /**
3780 * Gets the number of times a marker was encountered.

Callers 1

exitFunction · 0.70

Calls 3

measureMethod · 0.80
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected