* Processes the provided label. * @param {string=} label label
(label)
| 199 | * @param {string=} label label |
| 200 | */ |
| 201 | timeAggregate(label) { |
| 202 | const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); |
| 203 | if (!prev) { |
| 204 | throw new Error( |
| 205 | `No such label '${label}' for WebpackLogger.timeAggregate()` |
| 206 | ); |
| 207 | } |
| 208 | const time = process.hrtime(prev); |
| 209 | /** @type {TimersMap} */ |
| 210 | (this[TIMERS_SYMBOL]).delete(label); |
| 211 | /** @type {TimersMap} */ |
| 212 | this[TIMERS_AGGREGATES_SYMBOL] = |
| 213 | this[TIMERS_AGGREGATES_SYMBOL] || new Map(); |
| 214 | const current = this[TIMERS_AGGREGATES_SYMBOL].get(label); |
| 215 | if (current !== undefined) { |
| 216 | if (time[1] + current[1] > 1e9) { |
| 217 | time[0] += current[0] + 1; |
| 218 | time[1] = time[1] - 1e9 + current[1]; |
| 219 | } else { |
| 220 | time[0] += current[0]; |
| 221 | time[1] += current[1]; |
| 222 | } |
| 223 | } |
| 224 | this[TIMERS_AGGREGATES_SYMBOL].set(label, time); |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * Time aggregate end. |
no test coverage detected