@@ -101,7 +101,8 @@ struct Stats {
101101 uint64_t invalidDestructorCount{0 };
102102 int64_t unDestructedItemCount{0 };
103103
104- std::map<TierId, std::map<PoolId, std::map<ClassId, AllocationClassBaseStat>>> allocationClassStats;
104+ std::map<TierId, std::map<PoolId, std::map<ClassId, AllocationClassBaseStat>>>
105+ allocationClassStats;
105106
106107 std::vector<double > slabsApproxFreePercentages;
107108
@@ -138,7 +139,9 @@ struct Stats {
138139
139140 if (FLAGS_report_memory_usage_stats != " " ) {
140141 for (TierId tid = 0 ; tid < slabsApproxFreePercentages.size (); tid++) {
141- out << folly::sformat (" tid{:2} free slabs : {:.2f}%" , tid, slabsApproxFreePercentages[tid]) << std::endl;
142+ out << folly::sformat (" tid{:2} free slabs : {:.2f}%" , tid,
143+ slabsApproxFreePercentages[tid])
144+ << std::endl;
142145 }
143146
144147 auto formatMemory = [&](size_t bytes) -> std::tuple<std::string, double > {
@@ -162,26 +165,25 @@ struct Stats {
162165 };
163166
164167 auto foreachAC = [&](auto cb) {
165- for (auto & tidStats : allocationClassStats) {
166- for (auto & pidStat : tidStats.second ) {
167- for (auto & cidStat : pidStat.second ) {
168+ for (auto & tidStats : allocationClassStats) {
169+ for (auto & pidStat : tidStats.second ) {
170+ for (auto & cidStat : pidStat.second ) {
168171 cb (tidStats.first , pidStat.first , cidStat.first , cidStat.second );
169172 }
170173 }
171174 }
172175 };
173176
174- foreachAC ([&](auto tid, auto pid, auto cid, auto stats){
177+ foreachAC ([&](auto tid, auto pid, auto cid, auto stats) {
175178 auto [allocSizeSuffix, allocSize] = formatMemory (stats.allocSize );
176179 auto [memorySizeSuffix, memorySize] = formatMemory (stats.memorySize );
177- out << folly::sformat (" tid{:2} pid{:2} cid{:4} {:8.2f}{} memorySize: {:8.2f}{}" ,
178- tid, pid, cid, allocSize, allocSizeSuffix, memorySize, memorySizeSuffix) << std::endl;
179- });
180-
181- foreachAC ([&](auto tid, auto pid, auto cid, auto stats){
182- auto [allocSizeSuffix, allocSize] = formatMemory (stats.allocSize );
183- out << folly::sformat (" tid{:2} pid{:2} cid{:4} {:8.2f}{} free: {:4.2f}%" ,
184- tid, pid, cid, allocSize, allocSizeSuffix, stats.approxFreePercent ) << std::endl;
180+ out << folly::sformat (
181+ " tid{:2} pid{:2} cid{:4} {:8.2f}{} memorySize:{:8.2f}{} "
182+ " free:{:4.2f}% rollingAvgAllocLatency:{:8.2f}ns" ,
183+ tid, pid, cid, allocSize, allocSizeSuffix, memorySize,
184+ memorySizeSuffix, stats.approxFreePercent ,
185+ stats.allocLatencyNs .estimate ())
186+ << std::endl;
185187 });
186188 }
187189
0 commit comments