summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-10 20:18:20 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-10 20:18:20 +0000
commitbac96616d3ffdda096b65155c7dd9c2fd3d5bc4a (patch)
tree3724a244f4bbc7f4e44f4d27d4c488a19d03314b /net
parent2c47bc10fd06fc047dda9526e81a125f6bf0db39 (diff)
downloadchromium_src-bac96616d3ffdda096b65155c7dd9c2fd3d5bc4a.zip
chromium_src-bac96616d3ffdda096b65155c7dd9c2fd3d5bc4a.tar.gz
chromium_src-bac96616d3ffdda096b65155c7dd9c2fd3d5bc4a.tar.bz2
Disk cache: Finish the current experiment.
Review URL: http://codereview.chromium.org/67046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13535 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/disk_cache/backend_impl.cc72
-rw-r--r--net/disk_cache/backend_impl.h2
-rw-r--r--net/disk_cache/eviction.cc2
3 files changed, 24 insertions, 52 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 4984ecf..fd39495 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -135,13 +135,16 @@ bool DelayedCacheCleanup(const std::wstring& full_path) {
return true;
}
-// Sets |stored_value| for the current experiment.
-void InitExperiment(int* stored_value) {
- if (*stored_value)
- return;
+// Sets |stored_value| for the current experiment. Returns false if the files
+// should be discarded.
+bool InitExperiment(int* stored_value) {
+ if (*stored_value <= 2) {
+ *stored_value = 0;
+ return true;
+ }
- // Don't add more people to the experiment; send them to group 1.
- *stored_value = 1;
+ // Discard current cache for groups 3 and 4.
+ return false;
}
} // namespace
@@ -214,8 +217,8 @@ bool BackendImpl::Init() {
}
init_ = true;
- if (data_)
- InitExperiment(&data_->header.experiment);
+ if (data_ && !InitExperiment(&data_->header.experiment))
+ return false;
if (!CheckIndex()) {
ReportError(ERR_INIT_FAILED);
@@ -898,20 +901,16 @@ void BackendImpl::AdjustMaxCacheSize(int table_len) {
// Let's not use more than the default size while we tune-up the performance
// of bigger caches. TODO(rvargas): remove this limit.
- // If we are creating the file, use 1 as the multiplier so the table size is
- // the same for everybody.
- int multiplier = table_len ? data_->header.experiment : 1;
- DCHECK(multiplier > 0 && multiplier < 5);
- max_size_ = kDefaultCacheSize * multiplier;
+ if (max_size_ > kDefaultCacheSize)
+ max_size_ = kDefaultCacheSize;
if (!table_len)
return;
// If we already have a table, adjust the size to it.
- // NOTE: Disabled for the experiment.
- // int current_max_size = MaxStorageSizeForTable(table_len);
- // if (max_size_ > current_max_size)
- // max_size_= current_max_size;
+ int current_max_size = MaxStorageSizeForTable(table_len);
+ if (max_size_ > current_max_size)
+ max_size_= current_max_size;
}
void BackendImpl::RestartCache() {
@@ -936,9 +935,6 @@ void BackendImpl::PrepareForRestart() {
rankings_.Reset();
init_ = false;
restarted_ = true;
-
- // TODO(rvargas): remove this line at the end of this experiment.
- max_size_ = 0;
}
int BackendImpl::NewEntry(Addr address, EntryImpl** entry, bool* dirty) {
@@ -1274,33 +1270,17 @@ void BackendImpl::LogStats() {
}
void BackendImpl::ReportStats() {
- int experiment = data_->header.experiment;
- CACHE_UMA(COUNTS, "Entries", experiment, data_->header.num_entries);
- CACHE_UMA(COUNTS, "Size", experiment,
- data_->header.num_bytes / (1024 * 1024));
- CACHE_UMA(COUNTS, "MaxSize", experiment, max_size_ / (1024 * 1024));
+ CACHE_UMA(COUNTS, "Entries", 0, data_->header.num_entries);
+ CACHE_UMA(COUNTS, "Size", 0, data_->header.num_bytes / (1024 * 1024));
+ CACHE_UMA(COUNTS, "MaxSize", 0, max_size_ / (1024 * 1024));
CACHE_UMA(COUNTS, "AverageOpenEntries", 0,
- static_cast<int>(stats_.GetCounter(Stats::OPEN_ENTRIES)));
+ static_cast<int>(stats_.GetCounter(Stats::OPEN_ENTRIES)));
CACHE_UMA(COUNTS, "MaxOpenEntries", 0,
- static_cast<int>(stats_.GetCounter(Stats::MAX_ENTRIES)));
+ static_cast<int>(stats_.GetCounter(Stats::MAX_ENTRIES)));
stats_.SetCounter(Stats::MAX_ENTRIES, 0);
- if (!data_->header.create_time) {
- // This is a client running the experiment on the dev channel.
- CACHE_UMA(PERCENTAGE, "HitRatio", experiment, stats_.GetHitRatio());
- stats_.ResetRatios();
-
- if (!data_->header.num_bytes)
- return;
-
- int large_entries_bytes = stats_.GetLargeEntriesSize();
- int large_ratio = large_entries_bytes * 100 / data_->header.num_bytes;
- CACHE_UMA(PERCENTAGE, "LargeEntriesRatio", experiment, large_ratio);
- return;
- }
-
- if (!data_->header.lru.filled)
+ if (!data_->header.create_time || !data_->header.lru.filled)
return;
// This is an up to date client that will report FirstEviction() data. After
@@ -1406,14 +1386,6 @@ bool BackendImpl::CheckIndex() {
if (!mask_)
mask_ = data_->header.table_len - 1;
- // TODO(rvargas): remove this. For some reason, we are receiving crashes with
- // mask_ being bigger than the actual table length. (bug 7217).
- if (mask_ > 0xffff) {
- LOG(ERROR) << "Invalid cache mask";
- ReportError(ERR_INVALID_MASK);
- return false;
- }
-
return true;
}
diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h
index 3fbc2a4..b1b6478 100644
--- a/net/disk_cache/backend_impl.h
+++ b/net/disk_cache/backend_impl.h
@@ -107,7 +107,7 @@ class BackendImpl : public Backend {
// Returns the full histogram name, for the given base |name| and experiment,
// and the current cache type. The name will be "DiskCache.t.name_e" where n
- // is th ecache type and e the provided |experiment|.
+ // is the cache type and e the provided |experiment|.
std::string HistogramName(const char* name, int experiment);
net::CacheType cache_type() {
diff --git a/net/disk_cache/eviction.cc b/net/disk_cache/eviction.cc
index c000342..668fec2 100644
--- a/net/disk_cache/eviction.cc
+++ b/net/disk_cache/eviction.cc
@@ -142,7 +142,7 @@ void Eviction::ReportTrimTimes(EntryImpl* entry) {
if (first_trim_) {
first_trim_ = false;
if (backend_->ShouldReportAgain()) {
- CACHE_UMA(AGE, "TrimAge", header_->experiment, entry->GetLastUsed());
+ CACHE_UMA(AGE, "TrimAge", 0, entry->GetLastUsed());
}
if (header_->create_time && !header_->lru.filled) {