summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/field_trial.cc12
-rw-r--r--base/field_trial.h5
-rw-r--r--chrome/renderer/render_view.cc16
-rw-r--r--net/disk_cache/backend_impl.cc26
4 files changed, 55 insertions, 4 deletions
diff --git a/base/field_trial.cc b/base/field_trial.cc
index 2b354d7..0bf39e2 100644
--- a/base/field_trial.cc
+++ b/base/field_trial.cc
@@ -67,9 +67,12 @@ std::string FieldTrial::MakeName(const std::string& name_prefix,
// static
FieldTrialList* FieldTrialList::global_ = NULL;
-FieldTrialList::FieldTrialList()
- : application_start_time_(Time::Now()) {
+// static
+bool FieldTrialList::register_without_global_ = false;
+
+FieldTrialList::FieldTrialList() : application_start_time_(Time::Now()) {
DCHECK(!global_);
+ DCHECK(!register_without_global_);
global_ = this;
}
@@ -86,9 +89,10 @@ FieldTrialList::~FieldTrialList() {
// static
void FieldTrialList::Register(FieldTrial* trial) {
- DCHECK(global_);
- if (!global_)
+ if (!global_) {
+ register_without_global_ = true;
return;
+ }
AutoLock auto_lock(global_->lock_);
DCHECK(!global_->PreLockedFind(trial->name()));
trial->AddRef();
diff --git a/base/field_trial.h b/base/field_trial.h
index fba0b01..a26bde8f 100644
--- a/base/field_trial.h
+++ b/base/field_trial.h
@@ -210,6 +210,11 @@ class FieldTrialList {
static FieldTrialList* global_; // The singleton of this class.
+ // This will tell us if there is an attempt to register a field trial without
+ // creating the FieldTrialList. This is not an error, unless a FieldTrialList
+ // is created after that.
+ static bool register_without_global_;
+
// A helper value made availabel to users, that shows when the FieldTrialList
// was initialized. Note that this is a singleton instance, and hence is a
// good approximation to the start of the process.
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index f08ad79e..5000ec1 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2947,6 +2947,22 @@ void RenderView::DumpLoadHistograms() const {
kBeginToFinishMax, kBeginToFinishBucketCount);
}
+ static bool use_cache_histogram1(FieldTrialList::Find("CacheSize") &&
+ !FieldTrialList::Find("CacheSize")->group_name().empty());
+ if (use_cache_histogram1)
+ UMA_HISTOGRAM_CUSTOM_TIMES(
+ FieldTrial::MakeName("Renderer4.StartToFinish", "CacheSize").data(),
+ finish - start, kBeginToFinishMin,
+ kBeginToFinishMax, kBeginToFinishBucketCount);
+
+ static bool use_cache_histogram2(FieldTrialList::Find("NewEviction") &&
+ !FieldTrialList::Find("NewEviction")->group_name().empty());
+ if (use_cache_histogram2)
+ UMA_HISTOGRAM_CUSTOM_TIMES(
+ FieldTrial::MakeName("Renderer4.StartToFinish", "NewEviction").data(),
+ finish - start, kBeginToFinishMin,
+ kBeginToFinishMax, kBeginToFinishBucketCount);
+
UMA_HISTOGRAM_MEDIUM_TIMES("Renderer4.CommitToFinish", finish - commit);
if (!first_paint.is_null()) {
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_;
}