@@ -100,7 +100,8 @@ struct Stats {
100
100
uint64_t invalidDestructorCount{0 };
101
101
int64_t unDestructedItemCount{0 };
102
102
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;
104
105
105
106
std::vector<double > slabsApproxFreePercentages;
106
107
@@ -137,7 +138,9 @@ struct Stats {
137
138
138
139
if (FLAGS_report_memory_usage_stats != " " ) {
139
140
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;
141
144
}
142
145
143
146
auto formatMemory = [&](size_t bytes) -> std::tuple<std::string, double > {
@@ -161,26 +164,25 @@ struct Stats {
161
164
};
162
165
163
166
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 ) {
167
170
cb (tidStats.first , pidStat.first , cidStat.first , cidStat.second );
168
171
}
169
172
}
170
173
}
171
174
};
172
175
173
- foreachAC ([&](auto tid, auto pid, auto cid, auto stats){
176
+ foreachAC ([&](auto tid, auto pid, auto cid, auto stats) {
174
177
auto [allocSizeSuffix, allocSize] = formatMemory (stats.allocSize );
175
178
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;
184
186
});
185
187
}
186
188
0 commit comments