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

Side by Side Diff: chrome/browser/metrics/perf/perf_provider_chromeos.cc

Issue 1745723002: Fix ChromeOS-only static initializers from the last 5 months. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, address dhsharp comment Created 4 years, 8 months 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 | « chrome/browser/metrics/perf/perf_provider_chromeos.h ('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 (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/metrics/perf/perf_provider_chromeos.h" 5 #include "chrome/browser/metrics/perf/perf_provider_chromeos.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return cmds; 183 return cmds;
184 } 184 }
185 185
186 // Unknown CPUs 186 // Unknown CPUs
187 cmds.push_back(WeightAndValue(1.0, kPerfRecordCyclesCmd)); 187 cmds.push_back(WeightAndValue(1.0, kPerfRecordCyclesCmd));
188 return cmds; 188 return cmds;
189 } 189 }
190 190
191 } // namespace internal 191 } // namespace internal
192 192
193 PerfProvider::CollectionParams::CollectionParams()
194 : CollectionParams(
195 base::TimeDelta::FromSeconds(2) /* collection_duration */,
196 base::TimeDelta::FromHours(3) /* periodic_interval */,
197 PerfProvider::CollectionParams::TriggerParams( /* resume_from_suspend */
198 10 /* sampling_factor */,
199 base::TimeDelta::FromSeconds(5)) /* max_collection_delay */,
200 PerfProvider::CollectionParams::TriggerParams( /* restore_session */
201 10 /* sampling_factor */,
202 base::TimeDelta::FromSeconds(10)) /* max_collection_delay */) {
203 }
204
193 PerfProvider::CollectionParams::CollectionParams( 205 PerfProvider::CollectionParams::CollectionParams(
194 base::TimeDelta collection_duration, 206 base::TimeDelta collection_duration,
195 base::TimeDelta periodic_interval, 207 base::TimeDelta periodic_interval,
196 TriggerParams resume_from_suspend, 208 TriggerParams resume_from_suspend,
197 TriggerParams restore_session) 209 TriggerParams restore_session)
198 : collection_duration_(collection_duration.ToInternalValue()), 210 : collection_duration_(collection_duration.ToInternalValue()),
199 periodic_interval_(periodic_interval.ToInternalValue()), 211 periodic_interval_(periodic_interval.ToInternalValue()),
200 resume_from_suspend_(resume_from_suspend), 212 resume_from_suspend_(resume_from_suspend),
201 restore_session_(restore_session) { 213 restore_session_(restore_session) {
202 } 214 }
203 215
204 PerfProvider::CollectionParams::TriggerParams::TriggerParams( 216 PerfProvider::CollectionParams::TriggerParams::TriggerParams(
205 int64_t sampling_factor, 217 int64_t sampling_factor,
206 base::TimeDelta max_collection_delay) 218 base::TimeDelta max_collection_delay)
207 : sampling_factor_(sampling_factor), 219 : sampling_factor_(sampling_factor),
208 max_collection_delay_(max_collection_delay.ToInternalValue()) {} 220 max_collection_delay_(max_collection_delay.ToInternalValue()) {}
209 221
210 const PerfProvider::CollectionParams PerfProvider::kDefaultParameters(
211 /* collection_duration = */ base::TimeDelta::FromSeconds(2),
212 /* periodic_interval = */ base::TimeDelta::FromHours(3),
213 /* resume_from_suspend = */ PerfProvider::CollectionParams::TriggerParams(
214 /* sampling_factor = */ 10,
215 /* max_collection_delay = */ base::TimeDelta::FromSeconds(5)),
216 /* restore_session = */ PerfProvider::CollectionParams::TriggerParams(
217 /* sampling_factor = */ 10,
218 /* max_collection_delay = */ base::TimeDelta::FromSeconds(10)));
219
220 PerfProvider::PerfProvider() 222 PerfProvider::PerfProvider()
221 : collection_params_(kDefaultParameters), 223 : login_observer_(this),
222 login_observer_(this),
223 next_profiling_interval_start_(base::TimeTicks::Now()), 224 next_profiling_interval_start_(base::TimeTicks::Now()),
224 weak_factory_(this) { 225 weak_factory_(this) {
225 } 226 }
226 227
227 PerfProvider::~PerfProvider() { 228 PerfProvider::~PerfProvider() {
228 chromeos::LoginState::Get()->RemoveObserver(&login_observer_); 229 chromeos::LoginState::Get()->RemoveObserver(&login_observer_);
229 } 230 }
230 231
231 void PerfProvider::Init() { 232 void PerfProvider::Init() {
232 CHECK(command_selector_.SetOdds( 233 CHECK(command_selector_.SetOdds(
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 scoped_ptr<SampledProfile> sampled_profile(new SampledProfile); 622 scoped_ptr<SampledProfile> sampled_profile(new SampledProfile);
622 sampled_profile->set_trigger_event(SampledProfile::RESTORE_SESSION); 623 sampled_profile->set_trigger_event(SampledProfile::RESTORE_SESSION);
623 sampled_profile->set_ms_after_restore(time_after_restore.InMilliseconds()); 624 sampled_profile->set_ms_after_restore(time_after_restore.InMilliseconds());
624 sampled_profile->set_num_tabs_restored(num_tabs_restored); 625 sampled_profile->set_num_tabs_restored(num_tabs_restored);
625 626
626 CollectIfNecessary(std::move(sampled_profile)); 627 CollectIfNecessary(std::move(sampled_profile));
627 last_session_restore_collection_time_ = base::TimeTicks::Now(); 628 last_session_restore_collection_time_ = base::TimeTicks::Now();
628 } 629 }
629 630
630 } // namespace metrics 631 } // namespace metrics
OLDNEW
« no previous file with comments | « chrome/browser/metrics/perf/perf_provider_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698