From 7e05f6c4baad4f81e06835b83febe2784568ebe1 Mon Sep 17 00:00:00 2001 From: "rvargas@google.com" Date: Sat, 11 Jul 2009 01:50:48 +0000 Subject: 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 --- net/disk_cache/backend_impl.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'net/disk_cache/backend_impl.cc') 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 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 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_; } -- cgit v1.1