| 428 | } |
| 429 | |
| 430 | void ReservationTracker::CheckConsistency() const { |
| 431 | // Check internal invariants. |
| 432 | DCHECK_GE(reservation_.Load(), 0); |
| 433 | DCHECK_LE(reservation_.Load(), reservation_limit_.Load()); |
| 434 | DCHECK_GE(child_reservations_.Load(), 0); |
| 435 | DCHECK_GE(used_reservation_.Load(), 0); |
| 436 | DCHECK_LE(used_reservation_.Load() + child_reservations_.Load(), reservation_.Load()) |
| 437 | << used_reservation_.Load() << " + " << child_reservations_.Load() << " > " |
| 438 | << reservation_.Load(); |
| 439 | |
| 440 | DCHECK_EQ(reservation_.Load(), counters_.peak_reservation->current_value()); |
| 441 | DCHECK_LE(reservation_.Load(), counters_.peak_reservation->value()); |
| 442 | DCHECK_EQ(used_reservation_.Load(), counters_.peak_used_reservation->current_value()); |
| 443 | DCHECK_LE(used_reservation_.Load(), counters_.peak_used_reservation->value()); |
| 444 | if (counters_.reservation_limit != nullptr) { |
| 445 | DCHECK_EQ(reservation_limit_.Load(), counters_.reservation_limit->value()); |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | void ReservationTracker::UpdateUsedReservation(int64_t delta) { |
| 450 | int64_t used_reservation = used_reservation_.Add(delta); |
no test coverage detected