OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/backend_impl.h" | 5 #include "net/disk_cache/backend_impl.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 int avg_size = data_->header.num_bytes / GetEntryCount(); | 773 int avg_size = data_->header.num_bytes / GetEntryCount(); |
774 CACHE_UMA(COUNTS, "FirstEntrySize", 0, avg_size); | 774 CACHE_UMA(COUNTS, "FirstEntrySize", 0, avg_size); |
775 | 775 |
776 int large_entries_bytes = stats_.GetLargeEntriesSize(); | 776 int large_entries_bytes = stats_.GetLargeEntriesSize(); |
777 int large_ratio = large_entries_bytes * 100 / data_->header.num_bytes; | 777 int large_ratio = large_entries_bytes * 100 / data_->header.num_bytes; |
778 CACHE_UMA(PERCENTAGE, "FirstLargeEntriesRatio", 0, large_ratio); | 778 CACHE_UMA(PERCENTAGE, "FirstLargeEntriesRatio", 0, large_ratio); |
779 | 779 |
780 if (data_->header.experiment == 8) { | 780 if (data_->header.experiment == 8) { |
781 CACHE_UMA(PERCENTAGE, "FirstResurrectRatio", 8, stats_.GetResurrectRatio()); | 781 CACHE_UMA(PERCENTAGE, "FirstResurrectRatio", 8, stats_.GetResurrectRatio()); |
782 CACHE_UMA(PERCENTAGE, "FirstNoUseRatio", 8, | 782 CACHE_UMA(PERCENTAGE, "FirstNoUseRatio", 8, |
783 data_->header.lru.sizes[0] / data_->header.num_entries); | 783 data_->header.lru.sizes[0] * 100 / data_->header.num_entries); |
784 CACHE_UMA(PERCENTAGE, "FirstLowUseRatio", 8, | 784 CACHE_UMA(PERCENTAGE, "FirstLowUseRatio", 8, |
785 data_->header.lru.sizes[1] / data_->header.num_entries); | 785 data_->header.lru.sizes[1] * 100 / data_->header.num_entries); |
786 CACHE_UMA(PERCENTAGE, "FirstHighUseRatio", 8, | 786 CACHE_UMA(PERCENTAGE, "FirstHighUseRatio", 8, |
787 data_->header.lru.sizes[2] / data_->header.num_entries); | 787 data_->header.lru.sizes[2] * 100 / data_->header.num_entries); |
788 CACHE_UMA(PERCENTAGE, "FirstDeletedRatio", 8, | |
789 data_->header.lru.sizes[4] / data_->header.num_entries); | |
790 } | 788 } |
791 | 789 |
792 stats_.ResetRatios(); | 790 stats_.ResetRatios(); |
793 } | 791 } |
794 | 792 |
795 void BackendImpl::CriticalError(int error) { | 793 void BackendImpl::CriticalError(int error) { |
796 LOG(ERROR) << "Critical error found " << error; | 794 LOG(ERROR) << "Critical error found " << error; |
797 if (disabled_) | 795 if (disabled_) |
798 return; | 796 return; |
799 | 797 |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 CACHE_UMA(COUNTS, "EntrySize", data_->header.experiment, avg_size); | 1373 CACHE_UMA(COUNTS, "EntrySize", data_->header.experiment, avg_size); |
1376 | 1374 |
1377 int large_entries_bytes = stats_.GetLargeEntriesSize(); | 1375 int large_entries_bytes = stats_.GetLargeEntriesSize(); |
1378 int large_ratio = large_entries_bytes * 100 / data_->header.num_bytes; | 1376 int large_ratio = large_entries_bytes * 100 / data_->header.num_bytes; |
1379 CACHE_UMA(PERCENTAGE, "LargeEntriesRatio", 0, large_ratio); | 1377 CACHE_UMA(PERCENTAGE, "LargeEntriesRatio", 0, large_ratio); |
1380 | 1378 |
1381 if (new_eviction_) { | 1379 if (new_eviction_) { |
1382 CACHE_UMA(PERCENTAGE, "ResurrectRatio", data_->header.experiment, | 1380 CACHE_UMA(PERCENTAGE, "ResurrectRatio", data_->header.experiment, |
1383 stats_.GetResurrectRatio()); | 1381 stats_.GetResurrectRatio()); |
1384 CACHE_UMA(PERCENTAGE, "NoUseRatio", data_->header.experiment, | 1382 CACHE_UMA(PERCENTAGE, "NoUseRatio", data_->header.experiment, |
1385 data_->header.lru.sizes[0] / data_->header.num_entries); | 1383 data_->header.lru.sizes[0] * 100 / data_->header.num_entries); |
1386 CACHE_UMA(PERCENTAGE, "LowUseRatio", data_->header.experiment, | 1384 CACHE_UMA(PERCENTAGE, "LowUseRatio", data_->header.experiment, |
1387 data_->header.lru.sizes[1] / data_->header.num_entries); | 1385 data_->header.lru.sizes[1] * 100 / data_->header.num_entries); |
1388 CACHE_UMA(PERCENTAGE, "HighUseRatio", data_->header.experiment, | 1386 CACHE_UMA(PERCENTAGE, "HighUseRatio", data_->header.experiment, |
1389 data_->header.lru.sizes[2] / data_->header.num_entries); | 1387 data_->header.lru.sizes[2] * 100 / data_->header.num_entries); |
1390 CACHE_UMA(PERCENTAGE, "DeletedRatio", data_->header.experiment, | 1388 CACHE_UMA(PERCENTAGE, "DeletedRatio", data_->header.experiment, |
1391 data_->header.lru.sizes[4] / data_->header.num_entries); | 1389 data_->header.lru.sizes[4] * 100 / data_->header.num_entries); |
1392 } | 1390 } |
1393 | 1391 |
1394 stats_.ResetRatios(); | 1392 stats_.ResetRatios(); |
1395 stats_.SetCounter(Stats::TRIM_ENTRY, 0); | 1393 stats_.SetCounter(Stats::TRIM_ENTRY, 0); |
1396 } | 1394 } |
1397 | 1395 |
1398 void BackendImpl::UpgradeTo2_1() { | 1396 void BackendImpl::UpgradeTo2_1() { |
1399 // 2.1 is basically the same as 2.0, except that new fields are actually | 1397 // 2.1 is basically the same as 2.0, except that new fields are actually |
1400 // updated by the new eviction algorithm. | 1398 // updated by the new eviction algorithm. |
1401 DCHECK(0x20000 == data_->header.version); | 1399 DCHECK(0x20000 == data_->header.version); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 | 1501 |
1504 return num_dirty; | 1502 return num_dirty; |
1505 } | 1503 } |
1506 | 1504 |
1507 bool BackendImpl::CheckEntry(EntryImpl* cache_entry) { | 1505 bool BackendImpl::CheckEntry(EntryImpl* cache_entry) { |
1508 RankingsNode* rankings = cache_entry->rankings()->Data(); | 1506 RankingsNode* rankings = cache_entry->rankings()->Data(); |
1509 return !rankings->pointer; | 1507 return !rankings->pointer; |
1510 } | 1508 } |
1511 | 1509 |
1512 } // namespace disk_cache | 1510 } // namespace disk_cache |
OLD | NEW |