@@ -100,7 +100,8 @@ struct Stats {
100100 uint64_t invalidDestructorCount{0 };
101101 int64_t unDestructedItemCount{0 };
102102
103- std::map<TierId, std::map<PoolId, std::map<ClassId, AllocationClassBaseStat>>> allocationClassStats;
103+ std::map<TierId, std::map<PoolId, std::map<ClassId, AllocationClassBaseStat>>>
104+ allocationClassStats;
104105
105106 std::vector<double > slabsApproxFreePercentages;
106107
@@ -137,7 +138,9 @@ struct Stats {
137138
138139 if (FLAGS_report_memory_usage_stats != " " ) {
139140 for (TierId tid = 0 ; tid < slabsApproxFreePercentages.size (); tid++) {
140- out << folly::sformat (" tid{:2} free slabs : {:.2f}%" , tid, slabsApproxFreePercentages[tid]) << std::endl;
141+ out << folly::sformat (" tid{:2} free slabs : {:.2f}%" , tid,
142+ slabsApproxFreePercentages[tid])
143+ << std::endl;
141144 }
142145
143146 auto formatMemory = [&](size_t bytes) -> std::tuple<std::string, double > {
@@ -161,26 +164,25 @@ struct Stats {
161164 };
162165
163166 auto foreachAC = [&](auto cb) {
164- for (auto & tidStats : allocationClassStats) {
165- for (auto & pidStat : tidStats.second ) {
166- for (auto & cidStat : pidStat.second ) {
167+ for (auto & tidStats : allocationClassStats) {
168+ for (auto & pidStat : tidStats.second ) {
169+ for (auto & cidStat : pidStat.second ) {
167170 cb (tidStats.first , pidStat.first , cidStat.first , cidStat.second );
168171 }
169172 }
170173 }
171174 };
172175
173- foreachAC ([&](auto tid, auto pid, auto cid, auto stats){
176+ foreachAC ([&](auto tid, auto pid, auto cid, auto stats) {
174177 auto [allocSizeSuffix, allocSize] = formatMemory (stats.allocSize );
175178 auto [memorySizeSuffix, memorySize] = formatMemory (stats.memorySize );
176- out << folly::sformat (" tid{:2} pid{:2} cid{:4} {:8.2f}{} memorySize: {:8.2f}{}" ,
177- tid, pid, cid, allocSize, allocSizeSuffix, memorySize, memorySizeSuffix) << std::endl;
178- });
179-
180- foreachAC ([&](auto tid, auto pid, auto cid, auto stats){
181- auto [allocSizeSuffix, allocSize] = formatMemory (stats.allocSize );
182- out << folly::sformat (" tid{:2} pid{:2} cid{:4} {:8.2f}{} free: {:4.2f}%" ,
183- tid, pid, cid, allocSize, allocSizeSuffix, stats.approxFreePercent ) << std::endl;
179+ out << folly::sformat (
180+ " tid{:2} pid{:2} cid{:4} {:8.2f}{} memorySize:{:8.2f}{} "
181+ " free:{:4.2f}% rollingAvgAllocLatency:{:8.2f}ns" ,
182+ tid, pid, cid, allocSize, allocSizeSuffix, memorySize,
183+ memorySizeSuffix, stats.approxFreePercent ,
184+ stats.allocLatencyNs .estimate ())
185+ << std::endl;
184186 });
185187 }
186188
0 commit comments