Skip to content

Commit e014add

Browse files
committed
Add useCPED as a config option
1 parent 9fa16a3 commit e014add

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ts/src/time-profiler.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export interface TimeProfilerOptions {
6767
workaroundV8Bug?: boolean;
6868
collectCpuTime?: boolean;
6969
collectAsyncId?: boolean;
70+
useCPED?: boolean;
7071
}
7172

7273
const DEFAULT_OPTIONS: TimeProfilerOptions = {
@@ -77,6 +78,7 @@ const DEFAULT_OPTIONS: TimeProfilerOptions = {
7778
workaroundV8Bug: true,
7879
collectCpuTime: false,
7980
collectAsyncId: false,
81+
useCPED: false,
8082
};
8183

8284
export async function profile(options: TimeProfilerOptions = {}) {
@@ -93,15 +95,15 @@ export function start(options: TimeProfilerOptions = {}) {
9395
throw new Error('Wall profiler is already started');
9496
}
9597

96-
gProfiler = new TimeProfiler({...options, isMainThread, useCPED: false});
98+
gProfiler = new TimeProfiler({...options, isMainThread});
9799
gSourceMapper = options.sourceMapper;
98100
gIntervalMicros = options.intervalMicros!;
99101
gV8ProfilerStuckEventLoopDetected = 0;
100102

101103
gProfiler.start();
102104

103-
// If contexts are enabled, set an initial empty context
104-
if (options.withContexts) {
105+
// If contexts are enabled without using CPED, set an initial empty context
106+
if (options.withContexts && !options.useCPED) {
105107
setContext({});
106108
}
107109
}

0 commit comments

Comments
 (0)