Skip to content

Commit 8f88f3d

Browse files
committed
Add useCPED as a config option
1 parent 612aa88 commit 8f88f3d

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
@@ -66,6 +66,7 @@ export interface TimeProfilerOptions {
6666
withContexts?: boolean;
6767
workaroundV8Bug?: boolean;
6868
collectCpuTime?: boolean;
69+
useCPED?: boolean;
6970
}
7071

7172
const DEFAULT_OPTIONS: TimeProfilerOptions = {
@@ -75,6 +76,7 @@ const DEFAULT_OPTIONS: TimeProfilerOptions = {
7576
withContexts: false,
7677
workaroundV8Bug: true,
7778
collectCpuTime: false,
79+
useCPED: false,
7880
};
7981

8082
export async function profile(options: TimeProfilerOptions = {}) {
@@ -91,15 +93,15 @@ export function start(options: TimeProfilerOptions = {}) {
9193
throw new Error('Wall profiler is already started');
9294
}
9395

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

99101
gProfiler.start();
100102

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

0 commit comments

Comments
 (0)