diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-11 01:50:48 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-11 01:50:48 +0000 |
commit | 7e05f6c4baad4f81e06835b83febe2784568ebe1 (patch) | |
tree | e9f7079ff2c42ff257c9dd599d7896a0b7963126 /net | |
parent | 26f70b36e14369138eca64b68fca0ee3aa5a9b7a (diff) | |
download | chromium_src-7e05f6c4baad4f81e06835b83febe2784568ebe1.zip chromium_src-7e05f6c4baad4f81e06835b83febe2784568ebe1.tar.gz chromium_src-7e05f6c4baad4f81e06835b83febe2784568ebe1.tar.bz2 |
Disk cache: Generate total-load-time histograms from the
disk cache experiment.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/155380
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/disk_cache/backend_impl.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index e089660..ecbbcc2 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -4,6 +4,7 @@ #include "net/disk_cache/backend_impl.h" +#include "base/field_trial.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/histogram.h" @@ -169,6 +170,27 @@ bool InitExperiment(int* current_group) { return true; } +// Initializes the field trial structures to allow performance measurements +// for the current cache configuration. +void SetFieldTrialInfo(int experiment_group, int size_group) { + static bool first = true; + if (!first) + return; + + // Field trials involve static objects so we have to do this only once. + first = false; + scoped_refptr<FieldTrial> trial1 = new FieldTrial("CacheSize", 10); + std::string group1 = StringPrintf("CacheSizeGroup_%d", size_group); + trial1->AppendGroup(group1, FieldTrial::kAllRemainingProbability); + + if (experiment_group < 6 || experiment_group > 8) + return; + + scoped_refptr<FieldTrial> trial2 = new FieldTrial("NewEviction", 10); + std::string group2 = StringPrintf("NewEvictionGroup_%d", experiment_group); + trial2->AppendGroup(group2, FieldTrial::kAllRemainingProbability); +} + } // namespace // ------------------------------------------------------------------------ @@ -303,6 +325,10 @@ bool BackendImpl::Init() { disabled_ = !rankings_.Init(this, new_eviction_); eviction_.Init(this); + // Setup experiment data only for the main cache. + if (cache_type() == net::DISK_CACHE) + SetFieldTrialInfo(data_->header.experiment, GetSizeGroup()); + return !disabled_; } |