Skip to content

Commit 042c25d

Browse files
committed
fix profiling
1 parent 5e3acb5 commit 042c25d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

packages/profiling-node/test/cpu_profiler.test.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ContinuousThreadCpuProfile, ThreadCpuProfile } from '@sentry/core';
22
import { CpuProfilerBindings, PrivateCpuProfilerBindings } from '../src/cpu_profiler';
3-
import type { RawThreadCpuProfile } from '../src/types';
3+
import { ProfileFormat, RawThreadCpuProfile } from '../src/types';
44

55
// Required because we test a hypothetical long profile
66
// and we cannot use advance timers as the c++ relies on
@@ -19,10 +19,10 @@ const fibonacci = (n: number): number => {
1919
};
2020

2121
const wait = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
22-
const profiled = async (name: string, fn: () => void, format: 0 | 1 = 0) => {
22+
const profiled = async (name: string, fn: () => void) => {
2323
CpuProfilerBindings.startProfiling(name);
2424
await fn();
25-
return CpuProfilerBindings.stopProfiling(name, format);
25+
return CpuProfilerBindings.stopProfiling(name, ProfileFormat.THREAD);
2626
};
2727

2828
const assertValidSamplesAndStacks = (
@@ -216,15 +216,15 @@ describe('Profiler bindings', () => {
216216
});
217217

218218
it('chunk format type', async () => {
219-
const profile = await profiled(
220-
'non nullable stack',
221-
async () => {
222-
await wait(1000);
223-
fibonacci(36);
224-
await wait(1000);
225-
},
226-
1,
227-
);
219+
const fn = async () => {
220+
await wait(1000);
221+
fibonacci(36);
222+
await wait(1000);
223+
};
224+
225+
CpuProfilerBindings.startProfiling('non nullable stack');
226+
await fn();
227+
const profile = CpuProfilerBindings.stopProfiling('non nullable stack', ProfileFormat.CHUNK);
228228

229229
if (!profile) fail('Profile is null');
230230

0 commit comments

Comments
 (0)