| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/dns/host_cache.h" | 5 #include "net/dns/host_cache.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 CACHE_HISTOGRAM_COUNT("UpdateStale.NetworkChanges_Reordered", | 282 CACHE_HISTOGRAM_COUNT("UpdateStale.NetworkChanges_Reordered", |
| 283 stale.network_changes); | 283 stale.network_changes); |
| 284 break; | 284 break; |
| 285 case DELTA_OVERLAP: | 285 case DELTA_OVERLAP: |
| 286 CACHE_HISTOGRAM_TIME("UpdateStale.ExpiredBy_Overlap", stale.expired_by); | 286 CACHE_HISTOGRAM_TIME("UpdateStale.ExpiredBy_Overlap", stale.expired_by); |
| 287 CACHE_HISTOGRAM_COUNT("UpdateStale.NetworkChanges_Overlap", | 287 CACHE_HISTOGRAM_COUNT("UpdateStale.NetworkChanges_Overlap", |
| 288 stale.network_changes); | 288 stale.network_changes); |
| 289 break; | 289 break; |
| 290 case DELTA_DISJOINT: | 290 case DELTA_DISJOINT: |
| 291 CACHE_HISTOGRAM_TIME("UpdateStale.ExpiredBy_Disjoint", stale.expired_by); | 291 CACHE_HISTOGRAM_TIME("UpdateStale.ExpiredBy_Disjoint", stale.expired_by); |
| 292 CACHE_HISTOGRAM_COUNT("UpdateStale.NetworkChanges_Dijsoint", | 292 CACHE_HISTOGRAM_COUNT("UpdateStale.NetworkChanges_Disjoint", |
| 293 stale.network_changes); | 293 stale.network_changes); |
| 294 break; | 294 break; |
| 295 case MAX_DELTA_TYPE: | 295 case MAX_DELTA_TYPE: |
| 296 NOTREACHED(); | 296 NOTREACHED(); |
| 297 break; | 297 break; |
| 298 } | 298 } |
| 299 } | 299 } |
| 300 | 300 |
| 301 void HostCache::RecordLookup(LookupOutcome outcome, | 301 void HostCache::RecordLookup(LookupOutcome outcome, |
| 302 base::TimeTicks now, | 302 base::TimeTicks now, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 | 321 |
| 322 void HostCache::RecordErase(EraseReason reason, | 322 void HostCache::RecordErase(EraseReason reason, |
| 323 base::TimeTicks now, | 323 base::TimeTicks now, |
| 324 const Entry& entry) { | 324 const Entry& entry) { |
| 325 HostCache::EntryStaleness stale; | 325 HostCache::EntryStaleness stale; |
| 326 entry.GetStaleness(now, network_changes_, &stale); | 326 entry.GetStaleness(now, network_changes_, &stale); |
| 327 CACHE_HISTOGRAM_ENUM("Erase", reason, MAX_ERASE_REASON); | 327 CACHE_HISTOGRAM_ENUM("Erase", reason, MAX_ERASE_REASON); |
| 328 if (stale.is_stale()) { | 328 if (stale.is_stale()) { |
| 329 CACHE_HISTOGRAM_TIME("EvictStale.ExpiredBy", stale.expired_by); | 329 CACHE_HISTOGRAM_TIME("EraseStale.ExpiredBy", stale.expired_by); |
| 330 CACHE_HISTOGRAM_COUNT("EvictStale.NetworkChanges", stale.network_changes); | 330 CACHE_HISTOGRAM_COUNT("EraseStale.NetworkChanges", stale.network_changes); |
| 331 CACHE_HISTOGRAM_COUNT("EvictStale.StaleHits", entry.stale_hits()); | 331 CACHE_HISTOGRAM_COUNT("EraseStale.StaleHits", entry.stale_hits()); |
| 332 } else { | 332 } else { |
| 333 CACHE_HISTOGRAM_TIME("EvictValid.ValidFor", -stale.expired_by); | 333 CACHE_HISTOGRAM_TIME("EraseValid.ValidFor", -stale.expired_by); |
| 334 } | 334 } |
| 335 } | 335 } |
| 336 | 336 |
| 337 void HostCache::RecordEraseAll(EraseReason reason, base::TimeTicks now) { | 337 void HostCache::RecordEraseAll(EraseReason reason, base::TimeTicks now) { |
| 338 for (const auto& it : entries_) | 338 for (const auto& it : entries_) |
| 339 RecordErase(reason, now, it.second); | 339 RecordErase(reason, now, it.second); |
| 340 } | 340 } |
| 341 | 341 |
| 342 } // namespace net | 342 } // namespace net |
| OLD | NEW |