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

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

Issue 11785014: Record metrics for slow startups (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Android/Linux Aurora compile failure Created 7 years, 11 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 | Annotate | Revision Log
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_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 // Windows. 1608 // Windows.
1609 #if defined(OS_MACOSX) || defined(OS_WIN) 1609 #if defined(OS_MACOSX) || defined(OS_WIN)
1610 const base::Time *process_creation_time = 1610 const base::Time *process_creation_time =
1611 base::CurrentProcessInfo::CreationTime(); 1611 base::CurrentProcessInfo::CreationTime();
1612 1612
1613 if (process_creation_time) 1613 if (process_creation_time)
1614 RecordPreReadExperimentTime("Startup.BrowserMessageLoopStartTime", 1614 RecordPreReadExperimentTime("Startup.BrowserMessageLoopStartTime",
1615 base::Time::Now() - *process_creation_time); 1615 base::Time::Now() - *process_creation_time);
1616 #endif // OS_MACOSX || OS_WIN 1616 #endif // OS_MACOSX || OS_WIN
1617 1617
1618 // Startup.BrowserMessageLoopStartTime exhibits instability in the field 1618 // Record collected startup metrics.
1619 // which limits its usefullness in all scenarios except when we have a very 1619 startup_metric_utils::OnBrowserStartupComplete();
1620 // large sample size.
1621 // Attempt to mitigate this with a new metric:
1622 // * Measure time from main entry rather than the OS' notion of process start
1623 // time.
1624 // * Only measure launches that occur 7 minutes after boot to try to avoid
1625 // cases where Chrome is auto-started and IO is heavily loaded.
1626 const int64 kSevenMinutesInMilliseconds =
1627 base::TimeDelta::FromMinutes(7).InMilliseconds();
1628 if (base::SysInfo::Uptime() < kSevenMinutesInMilliseconds)
1629 return;
1630
1631 // Set up to match Startup.BrowserMessageLoopStartTime measurement above.
1632 const base::TimeDelta kStartupTimeMin(base::TimeDelta::FromMilliseconds(1));
1633 const base::TimeDelta kStartupTimeMax(base::TimeDelta::FromHours(1));
1634 static const size_t kStartupTimeBuckets(100);
1635 HISTOGRAM_CUSTOM_TIMES(
1636 "Startup.BrowserMessageLoopStartTimeFromMainEntry",
1637 base::Time::Now() - startup_metric_utils::MainEntryStartTime(),
1638 kStartupTimeMin,
1639 kStartupTimeMax,
1640 kStartupTimeBuckets);
1641 } 1620 }
1642 1621
1643 // This code is specific to the Windows-only PreReadExperiment field-trial. 1622 // This code is specific to the Windows-only PreReadExperiment field-trial.
1644 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time) { 1623 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time) {
1645 DCHECK(name != NULL); 1624 DCHECK(name != NULL);
1646 1625
1647 // This gets called with different histogram names, so we don't want to use 1626 // This gets called with different histogram names, so we don't want to use
1648 // the UMA_HISTOGRAM_CUSTOM_TIMES macro--it uses a static variable, and the 1627 // the UMA_HISTOGRAM_CUSTOM_TIMES macro--it uses a static variable, and the
1649 // first call wins. 1628 // first call wins.
1650 AddPreReadHistogramTime(name, time); 1629 AddPreReadHistogramTime(name, time);
(...skipping 14 matching lines...) Expand all
1665 if (base::win::GetVersion() <= base::win::VERSION_XP) 1644 if (base::win::GetVersion() <= base::win::VERSION_XP)
1666 uma_name += "_XP"; 1645 uma_name += "_XP";
1667 1646
1668 uma_name += "_PreRead_"; 1647 uma_name += "_PreRead_";
1669 uma_name += pre_read_percentage; 1648 uma_name += pre_read_percentage;
1670 AddPreReadHistogramTime(uma_name.c_str(), time); 1649 AddPreReadHistogramTime(uma_name.c_str(), time);
1671 } 1650 }
1672 #endif 1651 #endif
1673 #endif 1652 #endif
1674 } 1653 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_storage.cc ('k') | chrome/browser/safe_browsing/database_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698