@@ -99,7 +99,8 @@ struct Stats {
9999 uint64_t invalidDestructorCount{0 };
100100 int64_t unDestructedItemCount{0 };
101101
102- std::map<TierId, std::map<PoolId, std::map<ClassId, AllocationClassBaseStat>>> allocationClassStats;
102+ std::map<TierId, std::map<PoolId, std::map<ClassId, AllocationClassBaseStat>>>
103+ allocationClassStats;
103104
104105 std::vector<double > slabsApproxFreePercentages;
105106
@@ -125,7 +126,9 @@ struct Stats {
125126
126127 if (FLAGS_report_memory_usage_stats != " " ) {
127128 for (TierId tid = 0 ; tid < slabsApproxFreePercentages.size (); tid++) {
128- out << folly::sformat (" tid{:2} free slabs : {:.2f}%" , tid, slabsApproxFreePercentages[tid]) << std::endl;
129+ out << folly::sformat (" tid{:2} free slabs : {:.2f}%" , tid,
130+ slabsApproxFreePercentages[tid])
131+ << std::endl;
129132 }
130133
131134 auto formatMemory = [&](size_t bytes) -> std::tuple<std::string, double > {
@@ -149,26 +152,25 @@ struct Stats {
149152 };
150153
151154 auto foreachAC = [&](auto cb) {
152- for (auto & tidStats : allocationClassStats) {
153- for (auto & pidStat : tidStats.second ) {
154- for (auto & cidStat : pidStat.second ) {
155+ for (auto & tidStats : allocationClassStats) {
156+ for (auto & pidStat : tidStats.second ) {
157+ for (auto & cidStat : pidStat.second ) {
155158 cb (tidStats.first , pidStat.first , cidStat.first , cidStat.second );
156159 }
157160 }
158161 }
159162 };
160163
161- foreachAC ([&](auto tid, auto pid, auto cid, auto stats){
164+ foreachAC ([&](auto tid, auto pid, auto cid, auto stats) {
162165 auto [allocSizeSuffix, allocSize] = formatMemory (stats.allocSize );
163166 auto [memorySizeSuffix, memorySize] = formatMemory (stats.memorySize );
164- out << folly::sformat (" tid{:2} pid{:2} cid{:4} {:8.2f}{} memorySize: {:8.2f}{}" ,
165- tid, pid, cid, allocSize, allocSizeSuffix, memorySize, memorySizeSuffix) << std::endl;
166- });
167-
168- foreachAC ([&](auto tid, auto pid, auto cid, auto stats){
169- auto [allocSizeSuffix, allocSize] = formatMemory (stats.allocSize );
170- out << folly::sformat (" tid{:2} pid{:2} cid{:4} {:8.2f}{} free: {:4.2f}%" ,
171- tid, pid, cid, allocSize, allocSizeSuffix, stats.approxFreePercent ) << std::endl;
167+ out << folly::sformat (
168+ " tid{:2} pid{:2} cid{:4} {:8.2f}{} memorySize:{:8.2f}{} "
169+ " free:{:4.2f}% rollingAvgAllocLatency:{:8.2f}ns" ,
170+ tid, pid, cid, allocSize, allocSizeSuffix, memorySize,
171+ memorySizeSuffix, stats.approxFreePercent ,
172+ stats.allocLatencyNs .estimate ())
173+ << std::endl;
172174 });
173175 }
174176
0 commit comments