feat: record v8 cpu samples in the main process (#24819)
This commit is contained in:
parent
1709fed85e
commit
5d3301769b
2 changed files with 204 additions and 2 deletions
|
@ -120,4 +120,27 @@ ifdescribe(!(process.platform !== 'win32' && ['arm', 'arm64'].includes(process.a
|
|||
expect(resultFilePath).to.be.a('string').that.is.not.empty('result path');
|
||||
});
|
||||
});
|
||||
|
||||
describe('captured events', () => {
|
||||
it('include V8 samples from the main process', async () => {
|
||||
await contentTracing.startRecording({
|
||||
categoryFilter: 'disabled-by-default-v8.cpu_profiler',
|
||||
traceOptions: 'record-until-full'
|
||||
});
|
||||
{
|
||||
const start = +new Date();
|
||||
let n = 0;
|
||||
const f = () => {};
|
||||
while (+new Date() - start < 200 || n < 500) {
|
||||
await delay(0);
|
||||
f();
|
||||
n++;
|
||||
}
|
||||
}
|
||||
const path = await contentTracing.stopRecording();
|
||||
const data = fs.readFileSync(path, 'utf8');
|
||||
const parsed = JSON.parse(data);
|
||||
expect(parsed.traceEvents.some((x: any) => x.cat === 'disabled-by-default-v8.cpu_profiler' && x.name === 'ProfileChunk')).to.be.true();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue