* 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)
| 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. |