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

Side by Side Diff: chrome/browser/chrome_browser_field_trials.cc

Issue 2524363003: Support experiment configurations with/without stability metrics. (Closed)
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_browser_field_trials.h" 5 #include "chrome/browser/chrome_browser_field_trials.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/metrics/histogram_base.h" 13 #include "base/metrics/histogram_base.h"
14 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
15 #include "base/metrics/persistent_histogram_allocator.h" 15 #include "base/metrics/persistent_histogram_allocator.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "chrome/browser/metrics/chrome_metrics_service_client.h" 20 #include "chrome/browser/metrics/chrome_metrics_service_client.h"
21 #include "chrome/browser/metrics/chrome_metrics_services_manager_client.h" 21 #include "chrome/browser/metrics/chrome_metrics_services_manager_client.h"
22 #include "chrome/browser/tracing/background_tracing_field_trial.h" 22 #include "chrome/browser/tracing/background_tracing_field_trial.h"
23 #include "chrome/common/channel_info.h" 23 #include "chrome/common/channel_info.h"
24 #include "chrome/common/chrome_paths.h" 24 #include "chrome/common/chrome_paths.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "components/metrics/file_metrics_provider.h"
26 #include "components/metrics/metrics_pref_names.h" 27 #include "components/metrics/metrics_pref_names.h"
27 #include "components/variations/variations_associated_data.h" 28 #include "components/variations/variations_associated_data.h"
28 29
29 #if defined(OS_ANDROID) 30 #if defined(OS_ANDROID)
30 #include "chrome/browser/chrome_browser_field_trials_mobile.h" 31 #include "chrome/browser/chrome_browser_field_trials_mobile.h"
31 #else 32 #else
32 #include "chrome/browser/chrome_browser_field_trials_desktop.h" 33 #include "chrome/browser/chrome_browser_field_trials_desktop.h"
33 #endif 34 #endif
34 35
35 namespace { 36 namespace {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 const size_t kAllocSize = 3 << 20; // 3 MiB 74 const size_t kAllocSize = 3 << 20; // 3 MiB
74 const uint32_t kAllocId = 0x935DDD43; // SHA1(BrowserMetrics) 75 const uint32_t kAllocId = 0x935DDD43; // SHA1(BrowserMetrics)
75 std::string storage = variations::GetVariationParamValueByFeature( 76 std::string storage = variations::GetVariationParamValueByFeature(
76 base::kPersistentHistogramsFeature, "storage"); 77 base::kPersistentHistogramsFeature, "storage");
77 if (storage == "MappedFile") { 78 if (storage == "MappedFile") {
78 // Create global allocator with the "active" file. 79 // Create global allocator with the "active" file.
79 base::GlobalHistogramAllocator::CreateWithFile( 80 base::GlobalHistogramAllocator::CreateWithFile(
80 active_file, kAllocSize, kAllocId, 81 active_file, kAllocSize, kAllocId,
81 ChromeMetricsServiceClient::kBrowserMetricsName); 82 ChromeMetricsServiceClient::kBrowserMetricsName);
82 result = MAPPED_FILE_SUCCESS; 83 result = MAPPED_FILE_SUCCESS;
84 // Some configurations don't return unreported metrics from the previous
85 // run (otherwise known as "stability metrics").
86 std::string unreported = variations::GetVariationParamValueByFeature(
87 base::kPersistentHistogramsFeature, "send_unreported_metrics");
88 metrics::FileMetricsProvider::SetStabilityMetricsEnabled(
89 unreported == "yes");
Alexei Svitkine (slow) 2016/11/24 21:27:58 This would change the meaning of the existing grou
bcwhite 2016/11/25 18:51:57 I've never liked the double negatives that occur t
83 } else if (storage == "LocalMemory") { 90 } else if (storage == "LocalMemory") {
84 // Use local memory for storage even though it will not persist across 91 // Use local memory for storage even though it will not persist across
85 // an unclean shutdown. 92 // an unclean shutdown.
86 base::GlobalHistogramAllocator::CreateWithLocalMemory( 93 base::GlobalHistogramAllocator::CreateWithLocalMemory(
87 kAllocSize, kAllocId, ChromeMetricsServiceClient::kBrowserMetricsName); 94 kAllocSize, kAllocId, ChromeMetricsServiceClient::kBrowserMetricsName);
88 result = LOCAL_MEMORY_SUCCESS; 95 result = LOCAL_MEMORY_SUCCESS;
89 } else { 96 } else {
90 // Persistent metric storage is disabled. 97 // Persistent metric storage is disabled.
91 return; 98 return;
92 } 99 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 bool has_seed, 156 bool has_seed,
150 base::FeatureList* feature_list) { 157 base::FeatureList* feature_list) {
151 CreateFallbackSamplingTrialIfNeeded(has_seed, feature_list); 158 CreateFallbackSamplingTrialIfNeeded(has_seed, feature_list);
152 } 159 }
153 160
154 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { 161 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() {
155 // Persistent histograms must be enabled as soon as possible. 162 // Persistent histograms must be enabled as soon as possible.
156 InstantiatePersistentHistograms(); 163 InstantiatePersistentHistograms();
157 tracing::SetupBackgroundTracingFieldTrial(); 164 tracing::SetupBackgroundTracingFieldTrial();
158 } 165 }
OLDNEW
« no previous file with comments | « no previous file | components/metrics/file_metrics_provider.h » ('j') | components/metrics/file_metrics_provider.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698