| 198 | } |
| 199 | |
| 200 | void SizeMap::Dump(TCMalloc_Printer* out) { |
| 201 | // Dump class sizes and maximum external wastage per size class |
| 202 | for (size_t cl = 1; cl < kNumClasses; ++cl) { |
| 203 | const int alloc_size = class_to_pages_[cl] << kPageShift; |
| 204 | const int alloc_objs = alloc_size / class_to_size_[cl]; |
| 205 | const int min_used = (class_to_size_[cl-1] + 1) * alloc_objs; |
| 206 | const int max_waste = alloc_size - min_used; |
| 207 | out->printf("SC %3d [ %8d .. %8d ] from %8d ; %2.0f%% maxwaste\n", |
| 208 | int(cl), |
| 209 | int(class_to_size_[cl-1] + 1), |
| 210 | int(class_to_size_[cl]), |
| 211 | int(class_to_pages_[cl] << kPageShift), |
| 212 | max_waste * 100.0 / alloc_size |
| 213 | ); |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | // Metadata allocator -- keeps stats about how many bytes allocated. |
| 218 | static uint64_t metadata_system_bytes_ = 0; |