diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-18 22:14:42 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-18 22:14:42 +0000 |
commit | 772b57ab0dcd7843157b961f10999e48088e8973 (patch) | |
tree | 9cb191a11849956efd3d82a158d962117c0471ee /net/disk_cache | |
parent | 973da4d5cf9f9310e71ea3898d5514cdad85b255 (diff) | |
download | chromium_src-772b57ab0dcd7843157b961f10999e48088e8973.zip chromium_src-772b57ab0dcd7843157b961f10999e48088e8973.tar.gz chromium_src-772b57ab0dcd7843157b961f10999e48088e8973.tar.bz2 |
Disk cache: Re-open the deleted list length experiment.
BUG=79186
TEST=none
Review URL: http://codereview.chromium.org/7036028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85826 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r-- | net/disk_cache/backend_impl.cc | 74 | ||||
-rw-r--r-- | net/disk_cache/eviction.cc | 1 | ||||
-rw-r--r-- | net/disk_cache/experiments.h | 5 |
3 files changed, 54 insertions, 26 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index fc64f9bd..b60b8c0 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -147,9 +147,25 @@ bool DelayedCacheCleanup(const FilePath& full_path) { return true; } +// Initializes the field trial structures to allow performance measurements +// for the current cache configuration. +void SetFieldTrialInfo(int group) { + static bool first = true; + if (!first) + return; + + // Field trials involve static objects so we have to do this only once. + first = false; + std::string group1 = base::StringPrintf("CacheListSize_%d", group); + int probability = 10; + scoped_refptr<base::FieldTrial> trial1( + new base::FieldTrial("CacheListSize", probability, group1, 2011, 9, 30)); + trial1->AppendGroup(group1, probability); +} + // Sets group for the current experiment. Returns false if the files should be // discarded. -bool InitExperiment(disk_cache::IndexHeader* header) { +bool InitExperiment(disk_cache::IndexHeader* header, uint32 mask) { if (header->experiment == disk_cache::EXPERIMENT_OLD_FILE1 || header->experiment == disk_cache::EXPERIMENT_OLD_FILE2) { // Discard current cache. @@ -157,28 +173,35 @@ bool InitExperiment(disk_cache::IndexHeader* header) { } // See if we already defined the group for this profile. - if (header->experiment >= disk_cache::EXPERIMENT_DELETED_LIST_OUT) + if (header->experiment > disk_cache::EXPERIMENT_DELETED_LIST_OUT) { + SetFieldTrialInfo(header->experiment); return true; + } - // The experiment is closed. - header->experiment = disk_cache::EXPERIMENT_DELETED_LIST_OUT; - return true; -} + if (!header->create_time || !header->lru.filled) + return true; // Wait untill we fill up the cache. -// Initializes the field trial structures to allow performance measurements -// for the current cache configuration. -void SetFieldTrialInfo(int size_group) { - static bool first = true; - if (!first) - return; + int index_load = header->num_entries * 100 / (mask + 1); + if (index_load > 25) { + // Out of the experiment (~18% users). + header->experiment = disk_cache::EXPERIMENT_DELETED_LIST_OUT2; + return true; + } - // Field trials involve static objects so we have to do this only once. - first = false; - std::string group1 = base::StringPrintf("CacheSizeGroup_%d", size_group); - int totalProbability = 10; - scoped_refptr<base::FieldTrial> trial1( - new base::FieldTrial("CacheSize", totalProbability, group1, 2011, 6, 30)); - trial1->AppendGroup(group1, totalProbability); + int option = base::RandInt(0, 4); + if (option > 1) { + // 60% out (49% of the total). + header->experiment = disk_cache::EXPERIMENT_DELETED_LIST_OUT2; + } else if (!option) { + // About 16% of the total. + header->experiment = disk_cache::EXPERIMENT_DELETED_LIST_CONTROL; + } else { + // About 16% of the total. + header->experiment = disk_cache::EXPERIMENT_DELETED_LIST_IN; + } + + SetFieldTrialInfo(header->experiment); + return true; } // ------------------------------------------------------------------------ @@ -470,7 +493,7 @@ int BackendImpl::SyncInit() { if (!(user_flags_ & disk_cache::kNoRandom) && cache_type_ == net::DISK_CACHE && - !InitExperiment(&data_->header)) + !InitExperiment(&data_->header, mask_)) return net::ERR_FAILED; // We don't care if the value overflows. The only thing we care about is that @@ -497,10 +520,6 @@ int BackendImpl::SyncInit() { read_only_ = true; } - // Setup load-time data only for the main cache. - if (cache_type() == net::DISK_CACHE) - SetFieldTrialInfo(GetSizeGroup()); - eviction_.Init(this); // stats_ and rankings_ may end up calling back to us so we better be enabled. @@ -1059,6 +1078,13 @@ void BackendImpl::FirstEviction() { if (!GetEntryCount()) return; // This is just for unit tests. + if (!(user_flags_ & disk_cache::kNoRandom) && + cache_type_ == net::DISK_CACHE) { + // We were waiting for the first eviction to init the experiment. + bool rv = InitExperiment(&data_->header, mask_); + DCHECK(rv); + } + Time create_time = Time::FromInternalValue(data_->header.create_time); CACHE_UMA(AGE, "FillupAge", 0, create_time); diff --git a/net/disk_cache/eviction.cc b/net/disk_cache/eviction.cc index 672ca61..fd24d02 100644 --- a/net/disk_cache/eviction.cc +++ b/net/disk_cache/eviction.cc @@ -237,6 +237,7 @@ void Eviction::ReportTrimTimes(EntryImpl* entry) { if (header_->create_time) { // This is the first entry that we have to evict, generate some noise. backend_->FirstEviction(); + in_experiment_ = (header_->experiment == EXPERIMENT_DELETED_LIST_IN); } else { // This is an old file, but we may want more reports from this user so // lets save some create_time. diff --git a/net/disk_cache/experiments.h b/net/disk_cache/experiments.h index 5ca24db..c4e8ccb 100644 --- a/net/disk_cache/experiments.h +++ b/net/disk_cache/experiments.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,7 +17,8 @@ enum { EXPERIMENT_OLD_FILE2 = 4, EXPERIMENT_DELETED_LIST_OUT = 11, EXPERIMENT_DELETED_LIST_CONTROL = 12, - EXPERIMENT_DELETED_LIST_IN = 13 + EXPERIMENT_DELETED_LIST_IN = 13, + EXPERIMENT_DELETED_LIST_OUT2 = 14 }; } // namespace disk_cache |