OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/disk_cache/blockfile/webfonts_histogram.h" | 5 #include "net/disk_cache/blockfile/webfonts_histogram.h" |
6 | 6 |
7 #include "base/strings/string_piece.h" | 7 #include "base/strings/string_piece.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "net/disk_cache/blockfile/entry_impl.h" | 9 #include "net/disk_cache/blockfile/entry_impl.h" |
10 #include "net/disk_cache/blockfile/histogram_macros.h" | 10 #include "net/disk_cache/blockfile/histogram_macros.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 RecordCacheEvent(CACHE_EVENT_MISS, label); | 71 RecordCacheEvent(CACHE_EVENT_MISS, label); |
72 } | 72 } |
73 | 73 |
74 void RecordEvictedEntry(const std::string& key) { | 74 void RecordEvictedEntry(const std::string& key) { |
75 const char* label = HistogramLabel(key); | 75 const char* label = HistogramLabel(key); |
76 if (label) | 76 if (label) |
77 RecordCacheEvent(CACHE_EVENT_EVICTED_ENTRY, label); | 77 RecordCacheEvent(CACHE_EVENT_EVICTED_ENTRY, label); |
78 } | 78 } |
79 | 79 |
80 void RecordCacheHit(EntryImpl* entry) { | 80 void RecordCacheHit(EntryImpl* entry) { |
81 const char* label = HistogramLabel(entry->entry()->Data()->key); | 81 const char* label = HistogramLabel(entry->GetKey()); |
82 if (!label) | 82 if (!label) |
83 return; | 83 return; |
| 84 EntryStore* info = entry->entry()->Data(); |
84 CACHE_HISTOGRAM_COUNTS_10000(HistogramName("DiskCache.ReuseCount.Hit", label), | 85 CACHE_HISTOGRAM_COUNTS_10000(HistogramName("DiskCache.ReuseCount.Hit", label), |
85 entry->entry()->Data()->reuse_count); | 86 info->reuse_count); |
| 87 CACHE_HISTOGRAM_AGE(HistogramName("DiskCache.EntryAge.Hit", label), |
| 88 base::Time::FromInternalValue(info->creation_time)); |
86 RecordCacheEvent(CACHE_EVENT_HIT, label); | 89 RecordCacheEvent(CACHE_EVENT_HIT, label); |
87 } | 90 } |
88 | 91 |
89 void RecordEviction(EntryImpl* entry) { | 92 void RecordEviction(EntryImpl* entry) { |
90 const char* label = HistogramLabel(entry->entry()->Data()->key); | 93 const char* label = HistogramLabel(entry->GetKey()); |
91 if (label) | 94 if (!label) |
92 return; | 95 return; |
| 96 EntryStore* info = entry->entry()->Data(); |
93 CACHE_HISTOGRAM_COUNTS_10000( | 97 CACHE_HISTOGRAM_COUNTS_10000( |
94 HistogramName("DiskCache.ReuseCount.Evict", label), | 98 HistogramName("DiskCache.ReuseCount.Evict", label), |
95 entry->entry()->Data()->reuse_count); | 99 info->reuse_count); |
| 100 CACHE_HISTOGRAM_AGE(HistogramName("DiskCache.EntryAge.Evict", label), |
| 101 base::Time::FromInternalValue(info->creation_time)); |
96 } | 102 } |
97 | 103 |
98 } // namespace web_fonts_histogram | 104 } // namespace web_fonts_histogram |
99 } // namespace disk_cache | 105 } // namespace disk_cache |
OLD | NEW |