v8: add cpu profile APIs#59429
Conversation
f7114fb to
d49b31f
Compare
| V8::SetFlagsFromString(*flags, static_cast<size_t>(flags.length())); | ||
| } | ||
|
|
||
| class JSONOutputStream : public v8::OutputStream { |
There was a problem hiding this comment.
| class JSONOutputStream : public v8::OutputStream { | |
| class JSONOutputStream final : public v8::OutputStream { |
There was a problem hiding this comment.
Btw – we may want to use HeapSnapshotStream here? I know it requires a bit more setup, but it integrates nicely with existing stream primitives in Node.js
There was a problem hiding this comment.
I think these are two issues in HeapSnapshotStream:
- We should not delete the snapshot(which is created in worker) in main thread.
- It will crash when the worker exits.
const worker = require('worker_threads');
const w = new worker.Worker("setInterval(() => {}, 100)", { eval: true})
w.on('online', async () => {
const stream = await w.getHeapSnapshot()
stream.on('data', () => {});
// Crash
w.terminate();
});
szegedi
left a comment
There was a problem hiding this comment.
Advocating for using CpuProfiler::Start and thus eliminating the need for users to invent names for the profiler sessions in order to use the API.
f4618c5 to
e78d71a
Compare
5037a4a to
b3c64d0
Compare
b3c64d0 to
1b66417
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #59429 +/- ##
==========================================
+ Coverage 89.93% 89.95% +0.01%
==========================================
Files 667 667
Lines 196775 196841 +66
Branches 38409 38422 +13
==========================================
+ Hits 176977 177069 +92
+ Misses 12247 12200 -47
- Partials 7551 7572 +21
🚀 New features to boost your workflow:
|
Add CPU profile APIs.
make -j4 test(UNIX), orvcbuild test(Windows) passes