File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 88 ObjectGetOwnPropertyDescriptor,
99 SafeMap,
1010 StringPrototypeStartsWith,
11+ DateNow,
1112 globalThis,
1213} = primordials ;
1314
@@ -365,6 +366,7 @@ function initializeReportSignalHandlers() {
365366
366367function initializeHeapSnapshotSignalHandlers ( ) {
367368 const signal = getOptionValue ( '--heapsnapshot-signal' ) ;
369+ const diagnosticDir = getOptionValue ( '--diagnostic-dir' ) ;
368370
369371 if ( ! signal )
370372 return ;
@@ -373,7 +375,8 @@ function initializeHeapSnapshotSignalHandlers() {
373375 const { writeHeapSnapshot } = require ( 'v8' ) ;
374376
375377 function doWriteHeapSnapshot ( ) {
376- writeHeapSnapshot ( ) ;
378+ const heapSnapshotFilename = getHeapSnapshotFilename ( diagnosticDir ) ;
379+ writeHeapSnapshot ( heapSnapshotFilename ) ;
377380 }
378381 process . on ( signal , doWriteHeapSnapshot ) ;
379382
@@ -650,6 +653,11 @@ function markBootstrapComplete() {
650653 internalBinding ( 'performance' ) . markBootstrapComplete ( ) ;
651654}
652655
656+ function getHeapSnapshotFilename ( diagnosticDir ) {
657+ if ( ! diagnosticDir ) return undefined ;
658+ return `${ diagnosticDir } /Heap.${ DateNow ( ) } .heapsnapshot` ;
659+ }
660+
653661module . exports = {
654662 setupUserModules,
655663 prepareMainThreadExecution,
You can’t perform that action at this time.
0 commit comments