()
| 510 | } |
| 511 | |
| 512 | function initializeHeapSnapshotSignalHandlers() { |
| 513 | const signal = getOptionValue('--heapsnapshot-signal'); |
| 514 | const diagnosticDir = getOptionValue('--diagnostic-dir'); |
| 515 | |
| 516 | if (!signal) |
| 517 | return; |
| 518 | |
| 519 | require('internal/validators').validateSignalName(signal); |
| 520 | const { writeHeapSnapshot } = require('v8'); |
| 521 | |
| 522 | function doWriteHeapSnapshot() { |
| 523 | const heapSnapshotFilename = getHeapSnapshotFilename(diagnosticDir); |
| 524 | writeHeapSnapshot(heapSnapshotFilename); |
| 525 | } |
| 526 | process.on(signal, doWriteHeapSnapshot); |
| 527 | |
| 528 | // The code above would add the listener back during deserialization, |
| 529 | // if applicable. |
| 530 | if (isBuildingSnapshot()) { |
| 531 | addSerializeCallback(() => { |
| 532 | process.removeListener(signal, doWriteHeapSnapshot); |
| 533 | }); |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | function setupTraceCategoryState() { |
| 538 | const { isTraceCategoryEnabled } = internalBinding('trace_events'); |
no test coverage detected