File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 8
8
ObjectGetOwnPropertyDescriptor,
9
9
SafeMap,
10
10
StringPrototypeStartsWith,
11
+ DateNow,
11
12
globalThis,
12
13
} = primordials ;
13
14
@@ -365,6 +366,7 @@ function initializeReportSignalHandlers() {
365
366
366
367
function initializeHeapSnapshotSignalHandlers ( ) {
367
368
const signal = getOptionValue ( '--heapsnapshot-signal' ) ;
369
+ const diagnosticDir = getOptionValue ( '--diagnostic-dir' ) ;
368
370
369
371
if ( ! signal )
370
372
return ;
@@ -373,7 +375,8 @@ function initializeHeapSnapshotSignalHandlers() {
373
375
const { writeHeapSnapshot } = require ( 'v8' ) ;
374
376
375
377
function doWriteHeapSnapshot ( ) {
376
- writeHeapSnapshot ( ) ;
378
+ const heapSnapshotFilename = getHeapSnapshotFilename ( diagnosticDir ) ;
379
+ writeHeapSnapshot ( heapSnapshotFilename ) ;
377
380
}
378
381
process . on ( signal , doWriteHeapSnapshot ) ;
379
382
@@ -650,6 +653,11 @@ function markBootstrapComplete() {
650
653
internalBinding ( 'performance' ) . markBootstrapComplete ( ) ;
651
654
}
652
655
656
+ function getHeapSnapshotFilename ( diagnosticDir ) {
657
+ if ( ! diagnosticDir ) return undefined ;
658
+ return `${ diagnosticDir } /Heap.${ DateNow ( ) } .heapsnapshot` ;
659
+ }
660
+
653
661
module . exports = {
654
662
setupUserModules,
655
663
prepareMainThreadExecution,
You can’t perform that action at this time.
0 commit comments