| 199 | } |
| 200 | |
| 201 | void GPUMemoryPlanner::TrackDeallocate(void* ptr) { |
| 202 | if (!is_stats_.load()) { |
| 203 | return; |
| 204 | } |
| 205 | timeval tmp; |
| 206 | gettimeofday(&tmp, nullptr); |
| 207 | |
| 208 | AllocStats* alloc_stats; |
| 209 | { |
| 210 | std::lock_guard<spin_lock> l(stats_lock_); |
| 211 | auto iter = ptr_stats_.find(ptr); |
| 212 | if (iter == ptr_stats_.end()) { |
| 213 | return; |
| 214 | } |
| 215 | alloc_stats = iter->second; |
| 216 | ptr_stats_.erase(iter); |
| 217 | alloc_stats_.emplace_back(alloc_stats); |
| 218 | } |
| 219 | alloc_stats->end = Timeval2Double(tmp); |
| 220 | |
| 221 | if (SmallAlloc(alloc_stats->size)) { |
| 222 | GetSmallBin(alloc_stats->size)->TrackDeallocate(alloc_stats); |
| 223 | return; |
| 224 | } |
| 225 | |
| 226 | for (auto lifetime_policy : lifetime_stats_polices_) { |
| 227 | lifetime_policy->TrackDeallocate(alloc_stats); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | GPULifetimePolicy::GPULifetimePolicy(size_t interval, |
| 232 | size_t interval_offset, size_t start) : |
nothing calls this directly
no test coverage detected