Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2196)

Unified Diff: chrome/browser/chrome_browser_field_trials.cc

Issue 1425533011: Support "shared" histograms between processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shmem-alloc
Patch Set: extract common histogram FactoryGet code; extract histogram persistence into seperate files Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_browser_field_trials.cc
diff --git a/chrome/browser/chrome_browser_field_trials.cc b/chrome/browser/chrome_browser_field_trials.cc
index 9ce113f9675862b6cb790df76d78bb9d4ac5e5a8..8f5416921acae98e4794a781edf78d2f600bd1a4 100644
--- a/chrome/browser/chrome_browser_field_trials.cc
+++ b/chrome/browser/chrome_browser_field_trials.cc
@@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
+#include "base/metrics/histogram_base.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "chrome/common/chrome_switches.h"
@@ -40,6 +41,19 @@ void ChromeBrowserFieldTrials::SetupFieldTrials() {
}
void ChromeBrowserFieldTrials::InstantiateDynamicTrials() {
+ // Persistent histograms must be enabled as soon as possible.
+ const std::string group_name =
+ base::FieldTrialList::FindFullName("PersistentMetrics");
+ if (base::StartsWith(
+ group_name, "Enabled", base::CompareCase::INSENSITIVE_ASCII) &&
+ !parsed_command_line_.HasSwitch(switches::kDisablePersistentMetrics)) {
Alexei Svitkine (slow) 2015/12/15 22:48:52 Please use the base/feature_list.h API instead. Th
bcwhite 2015/12/16 16:23:46 Done.
+ // Create persistent/shared memory and allow histograms to be stored in it.
+ // TODO(bcwhite): Update this with correct allocator and memory size.
+ base::HistogramBase::SetDefaultPersistentMemoryAllocator(
+ new base::LocalPersistentMemoryAllocator(1 << 20, // 1 MiB
+ 0x4D5B9953, // SHA1(B..M..A..)
+ "BrowserMetricsAllocator"));
+ }
// The following trials are used from renderer process.
// Mark here so they will be sync-ed.
base::FieldTrialList::FindValue("DisplayList2dCanvas");

Powered by Google App Engine
This is Rietveld 408576698