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 // The eviction policy is a very simple pure LRU, so the elements at the end of | 5 // The eviction policy is a very simple pure LRU, so the elements at the end of |
6 // the list are evicted until kCleanUpMargin free space is available. There is | 6 // the list are evicted until kCleanUpMargin free space is available. There is |
7 // only one list in use (Rankings::NO_USE), and elements are sent to the front | 7 // only one list in use (Rankings::NO_USE), and elements are sent to the front |
8 // of the list whenever they are accessed. | 8 // of the list whenever they are accessed. |
9 | 9 |
10 // The new (in-development) eviction policy adds re-use as a factor to evict | 10 // The new (in-development) eviction policy adds re-use as a factor to evict |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "base/message_loop/message_loop.h" | 34 #include "base/message_loop/message_loop.h" |
35 #include "base/strings/string_util.h" | 35 #include "base/strings/string_util.h" |
36 #include "base/time/time.h" | 36 #include "base/time/time.h" |
37 #include "net/disk_cache/backend_impl.h" | 37 #include "net/disk_cache/backend_impl.h" |
38 #include "net/disk_cache/disk_format.h" | 38 #include "net/disk_cache/disk_format.h" |
39 #include "net/disk_cache/entry_impl.h" | 39 #include "net/disk_cache/entry_impl.h" |
40 #include "net/disk_cache/experiments.h" | 40 #include "net/disk_cache/experiments.h" |
41 #include "net/disk_cache/histogram_macros.h" | 41 #include "net/disk_cache/histogram_macros.h" |
42 #include "net/disk_cache/trace.h" | 42 #include "net/disk_cache/trace.h" |
43 | 43 |
| 44 // Provide a BackendImpl object to macros from histogram_macros.h. |
| 45 #define CACHE_UMA_BACKEND_IMPL_OBJ backend_ |
| 46 |
44 using base::Time; | 47 using base::Time; |
45 using base::TimeTicks; | 48 using base::TimeTicks; |
46 | 49 |
47 namespace { | 50 namespace { |
48 | 51 |
49 const int kCleanUpMargin = 1024 * 1024; | 52 const int kCleanUpMargin = 1024 * 1024; |
50 const int kHighUse = 10; // Reuse count to be on the HIGH_USE list. | 53 const int kHighUse = 10; // Reuse count to be on the HIGH_USE list. |
51 const int kTargetTime = 24 * 7; // Time to be evicted (hours since last use). | 54 const int kTargetTime = 24 * 7; // Time to be evicted (hours since last use). |
52 const int kMaxDelayedTrims = 60; | 55 const int kMaxDelayedTrims = 60; |
53 | 56 |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 Time::FromInternalValue(last2.get()->Data()->last_used)); | 591 Time::FromInternalValue(last2.get()->Data()->last_used)); |
589 if (last3.get()) | 592 if (last3.get()) |
590 CACHE_UMA(AGE, "HighUseAge", 0, | 593 CACHE_UMA(AGE, "HighUseAge", 0, |
591 Time::FromInternalValue(last3.get()->Data()->last_used)); | 594 Time::FromInternalValue(last3.get()->Data()->last_used)); |
592 if (last4.get()) | 595 if (last4.get()) |
593 CACHE_UMA(AGE, "DeletedAge", 0, | 596 CACHE_UMA(AGE, "DeletedAge", 0, |
594 Time::FromInternalValue(last4.get()->Data()->last_used)); | 597 Time::FromInternalValue(last4.get()->Data()->last_used)); |
595 } | 598 } |
596 | 599 |
597 } // namespace disk_cache | 600 } // namespace disk_cache |
OLD | NEW |