MCPcopy Index your code
hub / github.com/nodejs/node / getHeapSnapshotFilename

Function getHeapSnapshotFilename

lib/internal/process/pre_execution.js:786–805  ·  view source on GitHub ↗
(diagnosticDir)

Source from the content-addressed store, hash-verified

784
785// To generate the HeapSnapshotFilename while using custom diagnosticDir
786function getHeapSnapshotFilename(diagnosticDir) {
787 if (!diagnosticDir) return undefined;
788
789 const date = new Date();
790
791 const year = DatePrototypeGetFullYear(date);
792 const month = String(DatePrototypeGetMonth(date) + 1).padStart(2, '0');
793 const day = String(DatePrototypeGetDate(date)).padStart(2, '0');
794 const hours = String(DatePrototypeGetHours(date)).padStart(2, '0');
795 const minutes = String(DatePrototypeGetMinutes(date)).padStart(2, '0');
796 const seconds = String(DatePrototypeGetSeconds(date)).padStart(2, '0');
797
798 const dateString = `${year}${month}${day}`;
799 const timeString = `${hours}${minutes}${seconds}`;
800 const pid = process.pid;
801 const threadId = internalBinding('worker').threadId;
802 const fileSequence = (++sequenceNumOfheapSnapshot).toString().padStart(3, '0');
803
804 return `${diagnosticDir}/Heap.${dateString}.${timeString}.${pid}.${threadId}.${fileSequence}.heapsnapshot`;
805}
806
807module.exports = {
808 initializeModuleLoaders,

Callers 1

doWriteHeapSnapshotFunction · 0.85

Calls 2

StringClass · 0.85
toStringMethod · 0.45

Tested by

no test coverage detected