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

Function time

lib/internal/util/debuglog.js:232–253  ·  view source on GitHub ↗

* @param {SafeMap} timesStore * @param {string} traceCategory * @param {string} implementation * @param {number} timerFlags * @param {string} logLabel * @param {string} traceLabel * @returns {void}

(timesStore, traceCategory, implementation, timerFlags, logLabel = 'default', traceLabel = undefined)

Source from the content-addressed store, hash-verified

230 * @returns {void}
231 */
232function time(timesStore, traceCategory, implementation, timerFlags, logLabel = 'default', traceLabel = undefined) {
233 // Coerces everything other than Symbol to a string
234 logLabel = `${logLabel}`;
235
236 if (traceLabel !== undefined) {
237 traceLabel = `${traceLabel}`;
238 } else {
239 traceLabel = logLabel;
240 }
241
242 if (timesStore.has(logLabel)) {
243 process.emitWarning(`Label '${logLabel}' already exists for ${implementation}`);
244 return;
245 }
246
247 if ((timerFlags & kSkipTrace) === 0) {
248 traceLabel = safeTraceLabel(traceLabel);
249 trace(kTraceBegin, traceCategory, traceLabel, 0);
250 }
251
252 timesStore.set(logLabel, process.hrtime());
253}
254
255/**
256 * @param {SafeMap} timesStore

Callers 1

internalStartTimerFunction · 0.70

Calls 4

safeTraceLabelFunction · 0.85
traceFunction · 0.85
hasMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…