mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 10:46:28 -05:00
Restore global onProfilerEvent hook for ts-perf (#52523)
This commit is contained in:
@@ -11,6 +11,9 @@ import {
|
||||
|
||||
/** Performance measurements for the compiler. */
|
||||
|
||||
// NOTE: declared global is injected by ts-perf to monitor profiler marks to generate heap snapshots.
|
||||
declare let onProfilerEvent: ((eventName: string) => void) | undefined;
|
||||
|
||||
let perfHooks: PerformanceHooks | undefined;
|
||||
// when set, indicates the implementation of `Performance` to use for user timing.
|
||||
// when unset, indicates user timing is unavailable or disabled.
|
||||
@@ -74,6 +77,9 @@ export function mark(markName: string) {
|
||||
counts.set(markName, count + 1);
|
||||
marks.set(markName, timestamp());
|
||||
performanceImpl?.mark(markName);
|
||||
if (typeof onProfilerEvent === "function") {
|
||||
onProfilerEvent(markName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user