@@ -96,7 +96,8 @@ struct Stats {
96
96
uint64_t invalidDestructorCount{0 };
97
97
int64_t unDestructedItemCount{0 };
98
98
99
- std::map<TierId, std::map<PoolId, std::map<ClassId, AllocationClassBaseStat>>> allocationClassStats;
99
+ std::map<TierId, std::map<PoolId, std::map<ClassId, AllocationClassBaseStat>>>
100
+ allocationClassStats;
100
101
101
102
std::vector<double > slabsApproxFreePercentages;
102
103
@@ -122,7 +123,9 @@ struct Stats {
122
123
123
124
if (FLAGS_report_memory_usage_stats != " " ) {
124
125
for (TierId tid = 0 ; tid < slabsApproxFreePercentages.size (); tid++) {
125
- out << folly::sformat (" tid{:2} free slabs : {:.2f}%" , tid, slabsApproxFreePercentages[tid]) << std::endl;
126
+ out << folly::sformat (" tid{:2} free slabs : {:.2f}%" , tid,
127
+ slabsApproxFreePercentages[tid])
128
+ << std::endl;
126
129
}
127
130
128
131
auto formatMemory = [&](size_t bytes) -> std::tuple<std::string, double > {
@@ -146,26 +149,25 @@ struct Stats {
146
149
};
147
150
148
151
auto foreachAC = [&](auto cb) {
149
- for (auto & tidStats : allocationClassStats) {
150
- for (auto & pidStat : tidStats.second ) {
151
- for (auto & cidStat : pidStat.second ) {
152
+ for (auto & tidStats : allocationClassStats) {
153
+ for (auto & pidStat : tidStats.second ) {
154
+ for (auto & cidStat : pidStat.second ) {
152
155
cb (tidStats.first , pidStat.first , cidStat.first , cidStat.second );
153
156
}
154
157
}
155
158
}
156
159
};
157
160
158
- foreachAC ([&](auto tid, auto pid, auto cid, auto stats){
161
+ foreachAC ([&](auto tid, auto pid, auto cid, auto stats) {
159
162
auto [allocSizeSuffix, allocSize] = formatMemory (stats.allocSize );
160
163
auto [memorySizeSuffix, memorySize] = formatMemory (stats.memorySize );
161
- out << folly::sformat (" tid{:2} pid{:2} cid{:4} {:8.2f}{} memorySize: {:8.2f}{}" ,
162
- tid, pid, cid, allocSize, allocSizeSuffix, memorySize, memorySizeSuffix) << std::endl;
163
- });
164
-
165
- foreachAC ([&](auto tid, auto pid, auto cid, auto stats){
166
- auto [allocSizeSuffix, allocSize] = formatMemory (stats.allocSize );
167
- out << folly::sformat (" tid{:2} pid{:2} cid{:4} {:8.2f}{} free: {:4.2f}%" ,
168
- tid, pid, cid, allocSize, allocSizeSuffix, stats.approxFreePercent ) << std::endl;
164
+ out << folly::sformat (
165
+ " tid{:2} pid{:2} cid{:4} {:8.2f}{} memorySize:{:8.2f}{} "
166
+ " free:{:4.2f}% rollingAvgAllocLatency:{:8.2f}ns" ,
167
+ tid, pid, cid, allocSize, allocSizeSuffix, memorySize,
168
+ memorySizeSuffix, stats.approxFreePercent ,
169
+ stats.allocLatencyNs .estimate ())
170
+ << std::endl;
169
171
});
170
172
}
171
173
0 commit comments