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 | |
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
-rw-r--r-- | chrome/renderer/page_load_histograms.cc | 37 | ||||
-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 |
4 files changed, 67 insertions, 50 deletions
diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc index 6bd2c85..84365e8 100644 --- a/chrome/renderer/page_load_histograms.cc +++ b/chrome/renderer/page_load_histograms.cc @@ -513,58 +513,47 @@ void PageLoadHistograms::Dump(WebFrame* frame) { } } - // Histograms to determine if cache size has an impact on PLT. - static const bool use_cache_histogram1 = - base::FieldTrialList::TrialExists("CacheSize"); - if (use_cache_histogram1 && NavigationState::LINK_LOAD_NORMAL <= load_type && - NavigationState::LINK_LOAD_CACHE_ONLY >= load_type) { - // TODO(mbelshe): Do we really want BeginToFinishDoc here? It seems like - // StartToFinish or BeginToFinish would be better. - PLT_HISTOGRAM(base::FieldTrial::MakeName( - "PLT.BeginToFinishDoc_LinkLoad", "CacheSize"), begin_to_finish_doc); - } - - // Histograms to determine if cache throttling has an impact on PLT. - static const bool use_cache_histogram2 = - base::FieldTrialList::TrialExists("CacheThrottle"); - if (use_cache_histogram2) { + // Histograms to determine the PLT impact of the cache's deleted list size. + static const bool use_cache_histogram = + base::FieldTrialList::TrialExists("CacheListSize"); + if (use_cache_histogram) { UMA_HISTOGRAM_ENUMERATION( - base::FieldTrial::MakeName("PLT.Abandoned", "CacheThrottle"), + base::FieldTrial::MakeName("PLT.Abandoned", "CacheListSize"), abandoned_page ? 1 : 0, 2); switch (load_type) { case NavigationState::RELOAD: PLT_HISTOGRAM(base::FieldTrial::MakeName( - "PLT.BeginToFinish_Reload", "CacheThrottle"), + "PLT.BeginToFinish_Reload", "CacheListSize"), begin_to_finish_all_loads); break; case NavigationState::HISTORY_LOAD: PLT_HISTOGRAM(base::FieldTrial::MakeName( - "PLT.BeginToFinish_HistoryLoad", "CacheThrottle"), + "PLT.BeginToFinish_HistoryLoad", "CacheListSize"), begin_to_finish_all_loads); break; case NavigationState::NORMAL_LOAD: PLT_HISTOGRAM(base::FieldTrial::MakeName( - "PLT.BeginToFinish_NormalLoad", "CacheThrottle"), + "PLT.BeginToFinish_NormalLoad", "CacheListSize"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_NORMAL: PLT_HISTOGRAM(base::FieldTrial::MakeName( - "PLT.BeginToFinish_LinkLoadNormal", "CacheThrottle"), + "PLT.BeginToFinish_LinkLoadNormal", "CacheListSize"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_RELOAD: PLT_HISTOGRAM(base::FieldTrial::MakeName( - "PLT.BeginToFinish_LinkLoadReload", "CacheThrottle"), + "PLT.BeginToFinish_LinkLoadReload", "CacheListSize"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_CACHE_STALE_OK: PLT_HISTOGRAM(base::FieldTrial::MakeName( - "PLT.BeginToFinish_LinkLoadStaleOk", "CacheThrottle"), + "PLT.BeginToFinish_LinkLoadStaleOk", "CacheListSize"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_CACHE_ONLY: PLT_HISTOGRAM(base::FieldTrial::MakeName( - "PLT.BeginToFinish_LinkLoadCacheOnly", "CacheThrottle"), + "PLT.BeginToFinish_LinkLoadCacheOnly", "CacheListSize"), begin_to_finish_all_loads); break; default: @@ -573,7 +562,7 @@ void PageLoadHistograms::Dump(WebFrame* frame) { if (NavigationState::RELOAD <= load_type && NavigationState::LINK_LOAD_CACHE_ONLY >= load_type) { PLT_HISTOGRAM(base::FieldTrial::MakeName( - "PLT.BeginToFinish", "CacheThrottle"), + "PLT.BeginToFinish", "CacheListSize"), begin_to_finish_all_loads); } } 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 |