| 102 | } |
| 103 | |
| 104 | void ReservationTracker::InitCounters( |
| 105 | RuntimeProfile* profile, int64_t reservation_limit) { |
| 106 | if (profile == nullptr) { |
| 107 | dummy_profile_.reset(new DummyProfile); |
| 108 | profile = dummy_profile_->profile(); |
| 109 | } |
| 110 | |
| 111 | // Check that another tracker's counters aren't already registered in the profile. |
| 112 | DCHECK(profile->GetCounter("PeakReservation") == nullptr); |
| 113 | counters_.peak_reservation = |
| 114 | profile->AddHighWaterMarkCounter("PeakReservation", TUnit::BYTES); |
| 115 | counters_.peak_used_reservation = |
| 116 | profile->AddHighWaterMarkCounter("PeakUsedReservation", TUnit::BYTES); |
| 117 | // Only show the limit if set. |
| 118 | counters_.reservation_limit = nullptr; |
| 119 | if (reservation_limit != numeric_limits<int64_t>::max()) { |
| 120 | counters_.reservation_limit = ADD_COUNTER(profile, "ReservationLimit", TUnit::BYTES); |
| 121 | COUNTER_SET(counters_.reservation_limit, reservation_limit); |
| 122 | } |
| 123 | if (mem_tracker_ != nullptr) mem_tracker_->EnableReservationReporting(counters_); |
| 124 | } |
| 125 | |
| 126 | void ReservationTracker::Close() { |
| 127 | lock_guard<SpinLock> l(lock_); |
nothing calls this directly
no test coverage detected