@@ -499,6 +499,17 @@ static uint64_t writeMemProfCallStacks(
499499 return CallStackTableGenerator.Emit (OS.OS );
500500}
501501
502+ // Write out MemProf Version0 as follows:
503+ // uint64_t RecordTableOffset = RecordTableGenerator.Emit
504+ // uint64_t FramePayloadOffset = Offset for the frame payload
505+ // uint64_t FrameTableOffset = FrameTableGenerator.Emit
506+ // uint64_t Num schema entries
507+ // uint64_t Schema entry 0
508+ // uint64_t Schema entry 1
509+ // ....
510+ // uint64_t Schema entry N - 1
511+ // OnDiskChainedHashTable MemProfRecordData
512+ // OnDiskChainedHashTable MemProfFrameData
502513static Error writeMemProfV0 (ProfOStream &OS,
503514 memprof::IndexedMemProfData &MemProfData) {
504515 uint64_t HeaderUpdatePos = OS.tell ();
@@ -521,6 +532,18 @@ static Error writeMemProfV0(ProfOStream &OS,
521532 return Error::success ();
522533}
523534
535+ // Write out MemProf Version1 as follows:
536+ // uint64_t Version (NEW in V1)
537+ // uint64_t RecordTableOffset = RecordTableGenerator.Emit
538+ // uint64_t FramePayloadOffset = Offset for the frame payload
539+ // uint64_t FrameTableOffset = FrameTableGenerator.Emit
540+ // uint64_t Num schema entries
541+ // uint64_t Schema entry 0
542+ // uint64_t Schema entry 1
543+ // ....
544+ // uint64_t Schema entry N - 1
545+ // OnDiskChainedHashTable MemProfRecordData
546+ // OnDiskChainedHashTable MemProfFrameData
524547static Error writeMemProfV1 (ProfOStream &OS,
525548 memprof::IndexedMemProfData &MemProfData) {
526549 OS.write (memprof::Version1);
@@ -544,6 +567,21 @@ static Error writeMemProfV1(ProfOStream &OS,
544567 return Error::success ();
545568}
546569
570+ // Write out MemProf Version2 as follows:
571+ // uint64_t Version
572+ // uint64_t RecordTableOffset = RecordTableGenerator.Emit
573+ // uint64_t FramePayloadOffset = Offset for the frame payload
574+ // uint64_t FrameTableOffset = FrameTableGenerator.Emit
575+ // uint64_t CallStackPayloadOffset = Offset for the call stack payload (NEW V2)
576+ // uint64_t CallStackTableOffset = CallStackTableGenerator.Emit (NEW in V2)
577+ // uint64_t Num schema entries
578+ // uint64_t Schema entry 0
579+ // uint64_t Schema entry 1
580+ // ....
581+ // uint64_t Schema entry N - 1
582+ // OnDiskChainedHashTable MemProfRecordData
583+ // OnDiskChainedHashTable MemProfFrameData
584+ // OnDiskChainedHashTable MemProfCallStackData (NEW in V2)
547585static Error writeMemProfV2 (ProfOStream &OS,
548586 memprof::IndexedMemProfData &MemProfData,
549587 bool MemProfFullSchema) {
@@ -579,19 +617,7 @@ static Error writeMemProfV2(ProfOStream &OS,
579617 return Error::success ();
580618}
581619
582- // The MemProf profile data includes a simple schema
583- // with the format described below followed by the hashtable:
584- // uint64_t Version
585- // uint64_t RecordTableOffset = RecordTableGenerator.Emit
586- // uint64_t FramePayloadOffset = Stream offset before emitting the frame table
587- // uint64_t FrameTableOffset = FrameTableGenerator.Emit
588- // uint64_t Num schema entries
589- // uint64_t Schema entry 0
590- // uint64_t Schema entry 1
591- // ....
592- // uint64_t Schema entry N - 1
593- // OnDiskChainedHashTable MemProfRecordData
594- // OnDiskChainedHashTable MemProfFrameData
620+ // Write out the MemProf data in a requested version.
595621static Error writeMemProf (ProfOStream &OS,
596622 memprof::IndexedMemProfData &MemProfData,
597623 memprof::IndexedVersion MemProfVersionRequested,
0 commit comments