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

Side by Side Diff: components/startup_metric_utils/browser/startup_metric_utils.cc

Issue 1417673009: base: SysInfo::Uptime() returns a TimeDelta (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update perf_provider_chromeos.cc (just updated in another CL) 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/startup_metric_utils/browser/startup_metric_utils.h" 5 #include "components/startup_metric_utils/browser/startup_metric_utils.h"
6 6
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/environment.h" 8 #include "base/environment.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 341
342 const base::Time& process_creation_time = g_process_creation_time.Get(); 342 const base::Time& process_creation_time = g_process_creation_time.Get();
343 if (!is_first_run && !process_creation_time.is_null()) { 343 if (!is_first_run && !process_creation_time.is_null()) {
344 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( 344 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE(
345 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.BrowserMessageLoopStartTime", 345 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.BrowserMessageLoopStartTime",
346 process_creation_time, time); 346 process_creation_time, time);
347 } 347 }
348 348
349 // Bail if uptime < 7 minutes, to filter out cases where Chrome may have been 349 // Bail if uptime < 7 minutes, to filter out cases where Chrome may have been
350 // autostarted and the machine is under io pressure. 350 // autostarted and the machine is under io pressure.
351 const int64 kSevenMinutesInMilliseconds = 351 if (base::SysInfo::Uptime() < base::TimeDelta::FromMinutes(7))
352 base::TimeDelta::FromMinutes(7).InMilliseconds();
353 if (base::SysInfo::Uptime() < kSevenMinutesInMilliseconds)
354 return; 352 return;
355 353
356 // The Startup.BrowserMessageLoopStartTime histogram exhibits instability in 354 // The Startup.BrowserMessageLoopStartTime histogram exhibits instability in
357 // the field which limits its usefulness in all scenarios except when we have 355 // the field which limits its usefulness in all scenarios except when we have
358 // a very large sample size. Attempt to mitigate this with a new metric: 356 // a very large sample size. Attempt to mitigate this with a new metric:
359 // * Measure time from main entry rather than the OS' notion of process start. 357 // * Measure time from main entry rather than the OS' notion of process start.
360 // * Only measure launches that occur 7 minutes after boot to try to avoid 358 // * Only measure launches that occur 7 minutes after boot to try to avoid
361 // cases where Chrome is auto-started and IO is heavily loaded. 359 // cases where Chrome is auto-started and IO is heavily loaded.
362 const base::Time dll_main_time = MainEntryPointTime(); 360 const base::Time dll_main_time = MainEntryPointTime();
363 if (is_first_run) { 361 if (is_first_run) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 499
502 base::Time MainEntryPointTime() { 500 base::Time MainEntryPointTime() {
503 return g_main_entry_point_time.Get(); 501 return g_main_entry_point_time.Get();
504 } 502 }
505 503
506 StartupTemperature GetStartupTemperature() { 504 StartupTemperature GetStartupTemperature() {
507 return g_startup_temperature; 505 return g_startup_temperature;
508 } 506 }
509 507
510 } // namespace startup_metric_utils 508 } // namespace startup_metric_utils
OLDNEW
« no previous file with comments | « components/open_from_clipboard/clipboard_recent_content_ios.mm ('k') | content/browser/power_usage_monitor_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698