feat: record v8 cpu samples in the main process (#24819)

This commit is contained in:
Jeremy Rose 2020-08-21 09:25:30 -07:00 committed by GitHub
parent 1709fed85e
commit 5d3301769b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 204 additions and 2 deletions

View file

@ -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();
});
});
});