* Adds a performance measurement with the specified name. * * @param measureName The name of the performance measurement. * @param startMarkName The name of the starting mark * @param endMarkName The name of the ending mark
(measureName: string, startMarkName: string, endMarkName: string)
| 28 | * @param endMarkName The name of the ending mark |
| 29 | */ |
| 30 | function measure(measureName: string, startMarkName: string, endMarkName: string) { |
| 31 | if (enabled) { |
| 32 | const end = marks.get(endMarkName) ?? timestamp(); |
| 33 | const start = marks.get(startMarkName) ?? performance.timeOrigin; |
| 34 | const previousDuration = durations.get(measureName) ?? 0; |
| 35 | durations.set(measureName, previousDuration + (end - start)); |
| 36 | performance.measure(measureName, startMarkName, endMarkName); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Starts a performance measurement section. |
no test coverage detected