@@ -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 > {
@@ -142,26 +145,25 @@ struct Stats {
142
145
};
143
146
144
147
auto foreachAC = [&](auto cb) {
145
- for (auto & tidStats : allocationClassStats) {
146
- for (auto & pidStat : tidStats.second ) {
147
- for (auto & cidStat : pidStat.second ) {
148
+ for (auto & tidStats : allocationClassStats) {
149
+ for (auto & pidStat : tidStats.second ) {
150
+ for (auto & cidStat : pidStat.second ) {
148
151
cb (tidStats.first , pidStat.first , cidStat.first , cidStat.second );
149
152
}
150
153
}
151
154
}
152
155
};
153
156
154
- foreachAC ([&](auto tid, auto pid, auto cid, auto stats){
157
+ foreachAC ([&](auto tid, auto pid, auto cid, auto stats) {
155
158
auto [allocSizeSuffix, allocSize] = formatMemory (stats.allocSize );
156
159
auto [memorySizeSuffix, memorySize] = formatMemory (stats.memorySize );
157
- out << folly::sformat (" tid{:2} pid{:2} cid{:4} {:8.2f}{} memorySize: {:8.2f}{}" ,
158
- tid, pid, cid, allocSize, allocSizeSuffix, memorySize, memorySizeSuffix) << std::endl;
159
- });
160
-
161
- foreachAC ([&](auto tid, auto pid, auto cid, auto stats){
162
- auto [allocSizeSuffix, allocSize] = formatMemory (stats.allocSize );
163
- out << folly::sformat (" tid{:2} pid{:2} cid{:4} {:8.2f}{} free: {:4.2f}%" ,
164
- tid, pid, cid, allocSize, allocSizeSuffix, stats.approxFreePercent ) << std::endl;
160
+ out << folly::sformat (
161
+ " tid{:2} pid{:2} cid{:4} {:8.2f}{} memorySize:{:8.2f}{} "
162
+ " free:{:4.2f}% rollingAvgAllocLatency:{:8.2f}ns" ,
163
+ tid, pid, cid, allocSize, allocSizeSuffix, memorySize,
164
+ memorySizeSuffix, stats.approxFreePercent ,
165
+ stats.allocLatencyNs .estimate ())
166
+ << std::endl;
165
167
});
166
168
}
167
169
0 commit comments