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

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

Issue 1465273002: Stack sampling profiler: remove RUNTIME_FUNCTION sanity check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: make variations add to 100 Created 5 years, 1 month 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
« no previous file with comments | « base/profiler/win32_stack_frame_unwinder_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/stack_sampling_configuration.h" 5 #include "chrome/browser/stack_sampling_configuration.h"
6 6
7 #include "base/rand_util.h" 7 #include "base/rand_util.h"
8 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" 8 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
9 #include "chrome/common/channel_info.h" 9 #include "chrome/common/channel_info.h"
10 #include "components/version_info/version_info.h" 10 #include "components/version_info/version_info.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Enable according to the variations below in canary and dev. 126 // Enable according to the variations below in canary and dev.
127 if (chrome::GetChannel() == version_info::Channel::CANARY || 127 if (chrome::GetChannel() == version_info::Channel::CANARY ||
128 chrome::GetChannel() == version_info::Channel::DEV) { 128 chrome::GetChannel() == version_info::Channel::DEV) {
129 struct Variation { 129 struct Variation {
130 ProfileConfiguration config; 130 ProfileConfiguration config;
131 int weight; 131 int weight;
132 }; 132 };
133 133
134 // Generate a configuration according to the associated weights. 134 // Generate a configuration according to the associated weights.
135 const Variation variations[] = { 135 const Variation variations[] = {
136 { PROFILE_10HZ, 50}, 136 { PROFILE_10HZ, 15},
137 { PROFILE_CONTROL, 50}, 137 { PROFILE_CONTROL, 15},
138 { PROFILE_DISABLED, 0} 138 { PROFILE_DISABLED, 70}
139 }; 139 };
140 140
141 int total_weight = 0; 141 int total_weight = 0;
142 for (const Variation& variation : variations) 142 for (const Variation& variation : variations)
143 total_weight += variation.weight; 143 total_weight += variation.weight;
144 DCHECK_EQ(100, total_weight); 144 DCHECK_EQ(100, total_weight);
145 145
146 int chosen = base::RandInt(0, total_weight - 1); // Max is inclusive. 146 int chosen = base::RandInt(0, total_weight - 1); // Max is inclusive.
147 int cumulative_weight = 0; 147 int cumulative_weight = 0;
148 for (const Variation& variation : variations) { 148 for (const Variation& variation : variations) {
149 if (chosen >= cumulative_weight && 149 if (chosen >= cumulative_weight &&
150 chosen < cumulative_weight + variation.weight) { 150 chosen < cumulative_weight + variation.weight) {
151 return variation.config; 151 return variation.config;
152 } 152 }
153 cumulative_weight += variation.weight; 153 cumulative_weight += variation.weight;
154 } 154 }
155 NOTREACHED(); 155 NOTREACHED();
156 } 156 }
157 157
158 return PROFILE_DISABLED; 158 return PROFILE_DISABLED;
159 } 159 }
OLDNEW
« no previous file with comments | « base/profiler/win32_stack_frame_unwinder_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698