* @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)
| 230 | * @returns {void} |
| 231 | */ |
| 232 | function 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 |
no test coverage detected
searching dependent graphs…