Helper to get the # of bytes allocated by the group. Validates that the sum across all files equals this total.
| 291 | /// Helper to get the # of bytes allocated by the group. Validates that the sum across |
| 292 | /// all files equals this total. |
| 293 | static int64_t BytesAllocated(TmpFileGroup* group) { |
| 294 | int64_t bytes_allocated = 0; |
| 295 | for (unique_ptr<TmpFile>& file : group->tmp_files_) { |
| 296 | int64_t allocated = file->allocation_offset_; |
| 297 | int64_t reclaimed = file->bytes_reclaimed_.Load(); |
| 298 | EXPECT_GE(allocated, reclaimed); |
| 299 | bytes_allocated += allocated - reclaimed; |
| 300 | } |
| 301 | EXPECT_EQ(bytes_allocated, group->current_bytes_allocated_.Load()); |
| 302 | return bytes_allocated; |
| 303 | } |
| 304 | |
| 305 | /// Helper to validate the [start, end] index range for a given priority for a given |
| 306 | /// file group. |