@@ -355,6 +355,7 @@ perftools::profiles::Profile MakeTestProfile(
355355 sample.stack [4 ] = reinterpret_cast <void *>(&ProfileAccessor::MakeProfile);
356356 sample.access_hint = hot_cold_t {254 };
357357 sample.access_allocated = Profile::Sample::Access::Cold;
358+ sample.token_id = TokenId{0 };
358359 sample.guarded_status = Profile::Sample::GuardedStatus::RateLimited;
359360 sample.type = Profile::Sample::AllocationType::New;
360361 samples.push_back (sample);
@@ -401,6 +402,7 @@ perftools::profiles::Profile MakeTestProfile(
401402 sample.stack [3 ] = reinterpret_cast <void *>(&RealPath);
402403 sample.access_hint = hot_cold_t {1 };
403404 sample.access_allocated = Profile::Sample::Access::Hot;
405+ sample.token_id = TokenId{0 };
404406 sample.guarded_status = Profile::Sample::GuardedStatus::NoAvailableSlots;
405407 sample.type = Profile::Sample::AllocationType::Malloc;
406408
@@ -440,6 +442,7 @@ perftools::profiles::Profile MakeTestProfile(
440442 sample.stack [2 ] = reinterpret_cast <void *>(&RealPath);
441443 sample.access_hint = hot_cold_t {0 };
442444 sample.access_allocated = Profile::Sample::Access::Hot;
445+ sample.token_id = TokenId{0 };
443446 sample.guarded_status = Profile::Sample::GuardedStatus::RateLimited;
444447 sample.type = Profile::Sample::AllocationType::AlignedMalloc;
445448 }
@@ -470,6 +473,7 @@ perftools::profiles::Profile MakeTestProfile(
470473 sample.stack [4 ] = reinterpret_cast <void *>(&ProfileAccessor::MakeProfile);
471474 sample.access_hint = hot_cold_t {253 };
472475 sample.access_allocated = Profile::Sample::Access::Cold;
476+ sample.token_id = TokenId{1 };
473477 sample.guarded_status = Profile::Sample::GuardedStatus::RateLimited;
474478 sample.type = Profile::Sample::AllocationType::New;
475479 samples.push_back (sample);
@@ -595,10 +599,13 @@ TEST(ProfileConverterTest, HeapProfile) {
595599 }
596600 }
597601
598- EXPECT_THAT (label_to_units,
599- IsSupersetOf ({Pair (" bytes" , " bytes" ), Pair (" request" , " bytes" ),
600- Pair (" alignment" , " bytes" ),
601- Pair (" access_hint" , " access_hint" )}));
602+ EXPECT_THAT (label_to_units, IsSupersetOf ({
603+ Pair (" bytes" , " bytes" ),
604+ Pair (" request" , " bytes" ),
605+ Pair (" alignment" , " bytes" ),
606+ Pair (" access_hint" , " access_hint" ),
607+ Pair (" token_id" , " token_id" ),
608+ }));
602609
603610 EXPECT_THAT (
604611 label_to_units,
@@ -612,37 +619,42 @@ TEST(ProfileConverterTest, HeapProfile) {
612619 Pair (" bytes" , 16 ), Pair (" request" , 2 ), Pair (" alignment" , 4 ),
613620 Pair (" stale_scan_period" , 10 ),
614621 Pair (" access_hint" , 254 ), Pair (" access_allocated" , " cold" ),
615- Pair (" size_returning" , 1 ), Pair (" guarded_status" , " RateLimited" ),
622+ Pair (" token_id" , 0 ), Pair (" size_returning" , 1 ),
623+ Pair (" guarded_status" , " RateLimited" ),
616624 Pair (" allocation type" , " new" )),
617- UnorderedElementsAre (Pair (" bytes" , 8 ), Pair (" request" , 4 ),
618- Pair (" stale_scan_period" , 10 ),
619- Pair (" access_hint" , 1 ),
620- Pair (" access_allocated" , " hot" ),
621- Pair (" guarded_status" , " NoAvailableSlots" ),
622- Pair (" allocation type" , " malloc" )),
623625 UnorderedElementsAre (
624- Pair (" bytes" , 16 ), Pair (" request" , 16 ),
626+ Pair (" bytes" , 8 ), Pair (" request" , 4 ),
625627 Pair (" stale_scan_period" , 10 ),
626- Pair (" access_hint" , 0 ), Pair (" access_allocated" , " hot" ),
627- Pair (" size_returning" , 1 ), Pair (" guarded_status" , " RateLimited" ),
628- Pair (" allocation type" , " aligned malloc" )),
628+ Pair (" access_hint" , 1 ), Pair (" access_allocated" , " hot" ),
629+ Pair (" token_id" , 0 ), Pair (" guarded_status" , " NoAvailableSlots" ),
630+ Pair (" allocation type" , " malloc" )),
631+ UnorderedElementsAre (Pair (" bytes" , 16 ), Pair (" request" , 16 ),
632+ Pair (" stale_scan_period" , 10 ),
633+ Pair (" access_hint" , 0 ),
634+ Pair (" access_allocated" , " hot" ),
635+ Pair (" token_id" , 0 ), Pair (" size_returning" , 1 ),
636+ Pair (" guarded_status" , " RateLimited" ),
637+ Pair (" allocation type" , " aligned malloc" )),
629638 UnorderedElementsAre (
630639 Pair (" bytes" , 16 ), Pair (" request" , 2 ), Pair (" alignment" , 4 ),
631640 Pair (" stale_scan_period" , 10 ),
632641 Pair (" access_hint" , 253 ), Pair (" access_allocated" , " cold" ),
633- Pair (" size_returning" , 1 ), Pair (" guarded_status" , " RateLimited" ),
642+ Pair (" token_id" , 1 ), Pair (" size_returning" , 1 ),
643+ Pair (" guarded_status" , " RateLimited" ),
634644 Pair (" allocation type" , " new" )),
635645 UnorderedElementsAre (
636646 Pair (" bytes" , 16 ), Pair (" request" , 2 ), Pair (" alignment" , 4 ),
637647 Pair (" stale_scan_period" , 10 ),
638648 Pair (" access_hint" , 253 ), Pair (" access_allocated" , " cold" ),
639- Pair (" size_returning" , 1 ), Pair (" guarded_status" , " Filtered" ),
649+ Pair (" token_id" , 1 ), Pair (" size_returning" , 1 ),
650+ Pair (" guarded_status" , " Filtered" ),
640651 Pair (" allocation type" , " new" )),
641652 UnorderedElementsAre (
642653 Pair (" bytes" , 16 ), Pair (" request" , 2 ), Pair (" alignment" , 4 ),
643654 Pair (" stale_scan_period" , 10 ),
644655 Pair (" access_hint" , 253 ), Pair (" access_allocated" , " cold" ),
645- Pair (" size_returning" , 1 ), Pair (" guarded_status" , " Guarded" ),
656+ Pair (" token_id" , 1 ), Pair (" size_returning" , 1 ),
657+ Pair (" guarded_status" , " Guarded" ),
646658 Pair (" allocation type" , " new" ))));
647659
648660 EXPECT_THAT (extracted_samples,
@@ -743,6 +755,7 @@ TEST(ProfileBuilderTest, PeakHeapProfile) {
743755 sample.stack [2 ] = reinterpret_cast <void *>(&ProfileAccessor::MakeProfile);
744756 sample.access_hint = hot_cold_t {254 };
745757 sample.access_allocated = Profile::Sample::Access::Cold;
758+ sample.token_id = TokenId{0 };
746759 }
747760
748761 {
@@ -762,6 +775,7 @@ TEST(ProfileBuilderTest, PeakHeapProfile) {
762775 sample.stack [1 ] = reinterpret_cast <void *>(&RealPath);
763776 sample.access_hint = hot_cold_t {1 };
764777 sample.access_allocated = Profile::Sample::Access::Hot;
778+ sample.token_id = TokenId{0 };
765779 }
766780
767781 fake_profile->SetSamples (std::move (samples));
@@ -782,13 +796,14 @@ TEST(ProfileBuilderTest, PeakHeapProfile) {
782796 UnorderedElementsAre (
783797 Pair (" bytes" , 16 ), Pair (" request" , 2 ), Pair (" alignment" , 4 ),
784798 Pair (" access_hint" , 254 ), Pair (" access_allocated" , " cold" ),
785- Pair (" size_returning" , 1 ), Pair (" guarded_status" , " NotAttempted" ),
799+ Pair (" token_id" , 0 ), Pair (" size_returning" , 1 ),
800+ Pair (" guarded_status" , " NotAttempted" ),
786801 Pair (" allocation type" , " new" )),
787- UnorderedElementsAre (Pair ( " bytes " , 8 ), Pair ( " request " , 4 ),
788- Pair (" access_hint " , 1 ),
789- Pair (" access_allocated" , " hot" ),
790- Pair (" guarded_status" , " NotAttempted" ),
791- Pair (" allocation type" , " new" ))));
802+ UnorderedElementsAre (
803+ Pair ( " bytes " , 8 ), Pair (" request " , 4 ),
804+ Pair ( " access_hint " , 1 ), Pair (" access_allocated" , " hot" ),
805+ Pair ( " token_id " , 0 ), Pair (" guarded_status" , " NotAttempted" ),
806+ Pair (" allocation type" , " new" ))));
792807
793808 ASSERT_GE (converted.sample ().size (), 2 );
794809 ASSERT_GE (converted.sample (0 ).location_id ().size (), 2 );
@@ -1023,6 +1038,7 @@ TEST(ProfileBuilderTest, SameTags) {
10231038 " access_hint" ,
10241039 " access_allocated" ,
10251040 " size_returning" ,
1041+ " token_id" ,
10261042 " guarded_status" ,
10271043 };
10281044 EXPECT_THAT (allocation_tags, testing::IsSupersetOf (lifetime_missing_tags));
0 commit comments