@@ -499,6 +499,17 @@ static uint64_t writeMemProfCallStacks(
499
499
return CallStackTableGenerator.Emit (OS.OS );
500
500
}
501
501
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
502
513
static Error writeMemProfV0 (ProfOStream &OS,
503
514
memprof::IndexedMemProfData &MemProfData) {
504
515
uint64_t HeaderUpdatePos = OS.tell ();
@@ -521,6 +532,18 @@ static Error writeMemProfV0(ProfOStream &OS,
521
532
return Error::success ();
522
533
}
523
534
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
524
547
static Error writeMemProfV1 (ProfOStream &OS,
525
548
memprof::IndexedMemProfData &MemProfData) {
526
549
OS.write (memprof::Version1);
@@ -544,6 +567,21 @@ static Error writeMemProfV1(ProfOStream &OS,
544
567
return Error::success ();
545
568
}
546
569
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)
547
585
static Error writeMemProfV2 (ProfOStream &OS,
548
586
memprof::IndexedMemProfData &MemProfData,
549
587
bool MemProfFullSchema) {
@@ -579,19 +617,7 @@ static Error writeMemProfV2(ProfOStream &OS,
579
617
return Error::success ();
580
618
}
581
619
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.
595
621
static Error writeMemProf (ProfOStream &OS,
596
622
memprof::IndexedMemProfData &MemProfData,
597
623
memprof::IndexedVersion MemProfVersionRequested,
0 commit comments