diff options
-rw-r--r-- | chrome/browser/chrome_browser_main.cc | 28 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.cc | 7 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_io_data.cc | 4 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/local_database_manager.cc | 5 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_service.cc | 4 | ||||
-rw-r--r-- | chrome/browser/sessions/session_service.cc | 4 | ||||
-rw-r--r-- | components/bookmarks/browser/bookmark_storage.cc | 3 | ||||
-rw-r--r-- | components/startup_metric_utils/OWNERS | 3 | ||||
-rw-r--r-- | components/startup_metric_utils/startup_metric_utils.cc | 86 | ||||
-rw-r--r-- | components/startup_metric_utils/startup_metric_utils.h | 22 | ||||
-rw-r--r-- | crypto/nss_util.cc | 11 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 40 |
12 files changed, 42 insertions, 175 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 2b77ec8..462a275 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -536,31 +536,6 @@ void LaunchDevToolsHandlerIfNeeded(const base::CommandLine& command_line) { } } -// Heap allocated class that listens for first page load, kicks off stat -// recording and then deletes itself. -class LoadCompleteListener : public content::NotificationObserver { - public: - LoadCompleteListener() { - registrar_.Add(this, - content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, - content::NotificationService::AllSources()); - } - ~LoadCompleteListener() override {} - - // content::NotificationObserver implementation. - void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override { - DCHECK_EQ(content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, type); - startup_metric_utils::OnInitialPageLoadComplete(); - delete this; - } - - private: - content::NotificationRegistrar registrar_; - DISALLOW_COPY_AND_ASSIGN(LoadCompleteListener); -}; - } // namespace namespace chrome_browser { @@ -748,9 +723,6 @@ void ChromeBrowserMainParts::RecordBrowserStartupTime() { // Record collected startup metrics. startup_metric_utils::OnBrowserStartupComplete(is_first_run); - - // Deletes self. - new LoadCompleteListener(); } // ----------------------------------------------------------------------------- diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 6eb96e9..b61964d 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -88,7 +88,6 @@ #include "components/metrics/metrics_service.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/signin/core/browser/signin_manager.h" -#include "components/startup_metric_utils/startup_metric_utils.h" #include "components/ui/zoom/zoom_event_manager.h" #include "components/url_fixer/url_fixer.h" #include "components/user_prefs/user_prefs.h" @@ -451,10 +450,6 @@ ProfileImpl::ProfileImpl( } { - // On startup, preference loading is always synchronous so a scoped timer - // will work here. - startup_metric_utils::ScopedSlowStartupUMA - scoped_timer("Startup.SlowStartupPreferenceLoading"); prefs_ = chrome_prefs::CreateProfilePrefs( path_, sequenced_task_runner, @@ -468,8 +463,6 @@ ProfileImpl::ProfileImpl( user_prefs::UserPrefs::Set(this, prefs_.get()); } - startup_metric_utils::ScopedSlowStartupUMA - scoped_timer("Startup.SlowStartupFinalProfileInit"); if (async_prefs) { // Wait for the notification that prefs has been loaded // (successfully or not). Note that we can use base::Unretained diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index e625178..4e1f3b7 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -56,7 +56,6 @@ #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h" #include "components/dom_distiller/core/url_constants.h" -#include "components/startup_metric_utils/startup_metric_utils.h" #include "components/sync_driver/pref_names.h" #include "components/url_fixer/url_fixer.h" #include "content/public/browser/browser_thread.h" @@ -982,9 +981,6 @@ void ProfileIOData::Init( DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(!initialized_); - startup_metric_utils::ScopedSlowStartupUMA - scoped_timer("Startup.SlowStartupProfileIODataInit"); - // TODO(jhawkins): Remove once crbug.com/102004 is fixed. CHECK(initialized_on_UI_thread_); diff --git a/chrome/browser/safe_browsing/local_database_manager.cc b/chrome/browser/safe_browsing/local_database_manager.cc index a19eac9..e02db2d 100644 --- a/chrome/browser/safe_browsing/local_database_manager.cc +++ b/chrome/browser/safe_browsing/local_database_manager.cc @@ -27,7 +27,6 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" -#include "components/startup_metric_utils/startup_metric_utils.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "url/url_constants.h" @@ -750,10 +749,8 @@ SafeBrowsingDatabase* LocalSafeBrowsingDatabaseManager::GetDatabase() { if (database_) return database_; - startup_metric_utils::ScopedSlowStartupUMA - scoped_timer("Startup.SlowStartupSafeBrowsingGetDatabase"); - const base::TimeTicks before = base::TimeTicks::Now(); + const base::TimeTicks before = base::TimeTicks::Now(); SafeBrowsingDatabase* database = SafeBrowsingDatabase::Create( safe_browsing_task_runner_, enable_download_protection_, enable_csd_whitelist_, enable_download_whitelist_, diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index 0d7f7da..162e6c2 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -37,7 +37,6 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" -#include "components/startup_metric_utils/startup_metric_utils.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/cookie_store_factory.h" #include "content/public/browser/notification_service.h" @@ -218,9 +217,6 @@ SafeBrowsingService::~SafeBrowsingService() { } void SafeBrowsingService::Initialize() { - startup_metric_utils::ScopedSlowStartupUMA - scoped_timer("Startup.SlowStartupSafeBrowsingServiceInitialize"); - url_request_context_getter_ = new SafeBrowsingURLRequestContextGetter(this); diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 0b8759a..1e241d6 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -39,7 +39,6 @@ #include "components/sessions/content/content_serialized_navigation_builder.h" #include "components/sessions/session_command.h" #include "components/sessions/session_types.h" -#include "components/startup_metric_utils/startup_metric_utils.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" @@ -701,9 +700,6 @@ void SessionService::OnGotSessionCommands( ScopedVector<sessions::SessionWindow> valid_windows; SessionID::id_type active_window_id = 0; - startup_metric_utils::ScopedSlowStartupUMA - scoped_timer("Startup.SlowStartupSessionServiceCreateTabsAndWindows"); - sessions::RestoreSessionFromCommands( commands, &valid_windows.get(), &active_window_id); RemoveUnusedRestoreWindows(&valid_windows.get()); diff --git a/components/bookmarks/browser/bookmark_storage.cc b/components/bookmarks/browser/bookmark_storage.cc index 2612f9c..74d6417 100644 --- a/components/bookmarks/browser/bookmark_storage.cc +++ b/components/bookmarks/browser/bookmark_storage.cc @@ -16,7 +16,6 @@ #include "components/bookmarks/browser/bookmark_index.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/common/bookmark_constants.h" -#include "components/startup_metric_utils/startup_metric_utils.h" using base::TimeTicks; @@ -51,8 +50,6 @@ void LoadCallback(const base::FilePath& path, const base::WeakPtr<BookmarkStorage>& storage, scoped_ptr<BookmarkLoadDetails> details, base::SequencedTaskRunner* task_runner) { - startup_metric_utils::ScopedSlowStartupUMA - scoped_timer("Startup.SlowStartupBookmarksLoad"); bool load_index = false; bool bookmark_file_exists = base::PathExists(path); if (bookmark_file_exists) { diff --git a/components/startup_metric_utils/OWNERS b/components/startup_metric_utils/OWNERS index b112a84..f75fe2e 100644 --- a/components/startup_metric_utils/OWNERS +++ b/components/startup_metric_utils/OWNERS @@ -1 +1,2 @@ -jeremy@chromium.org
\ No newline at end of file +erikchen@chromium.org +gab@chromium.org diff --git a/components/startup_metric_utils/startup_metric_utils.cc b/components/startup_metric_utils/startup_metric_utils.cc index b82da00..1d546fe 100644 --- a/components/startup_metric_utils/startup_metric_utils.cc +++ b/components/startup_metric_utils/startup_metric_utils.cc @@ -7,12 +7,9 @@ #include "base/containers/hash_tables.h" #include "base/environment.h" #include "base/logging.h" -#include "base/metrics/histogram.h" -#include "base/metrics/histogram_base.h" -#include "base/metrics/statistics_recorder.h" +#include "base/metrics/histogram_macros.h" #include "base/process/process_info.h" #include "base/strings/string_number_conversions.h" -#include "base/synchronization/lock.h" #include "base/sys_info.h" #include "base/time/time.h" @@ -32,19 +29,6 @@ base::Time* MainEntryPointTimeInternal() { return &main_start_time; } -typedef base::hash_map<std::string,base::TimeDelta> SubsystemStartupTimeHash; - -SubsystemStartupTimeHash* GetSubsystemStartupTimeHash() { - static SubsystemStartupTimeHash* slow_startup_time_hash = - new SubsystemStartupTimeHash; - return slow_startup_time_hash; -} - -base::Lock* GetSubsystemStartupTimeHashLock() { - static base::Lock* slow_startup_time_hash_lock = new base::Lock; - return slow_startup_time_hash_lock; -} - #if defined(OS_WIN) // The struct used to return system process information via the NT internal @@ -218,8 +202,6 @@ void RecordMainEntryTimeHistogram() { } bool g_main_entry_time_was_recorded = false; -bool g_startup_stats_collection_finished = false; -bool g_was_slow_startup = false; // Environment variable that stores the timestamp when the executable's main() // function was entered. @@ -272,10 +254,8 @@ void OnBrowserStartupComplete(bool is_first_run) { // autostarted and the machine is under io pressure. const int64 kSevenMinutesInMilliseconds = base::TimeDelta::FromMinutes(7).InMilliseconds(); - if (base::SysInfo::Uptime() < kSevenMinutesInMilliseconds) { - g_startup_stats_collection_finished = true; + if (base::SysInfo::Uptime() < kSevenMinutesInMilliseconds) return; - } // The Startup.BrowserMessageLoopStartTime histogram recorded in // chrome_browser_main.cc exhibits instability in the field which limits its @@ -329,54 +309,6 @@ void OnBrowserStartupComplete(bool is_first_run) { } } #endif - - // Record histograms for the subsystem times for startups > 10 seconds. - const base::TimeDelta kTenSeconds = base::TimeDelta::FromSeconds(10); - if (startup_time_from_main_entry < kTenSeconds) { - g_startup_stats_collection_finished = true; - return; - } - - // If we got here this was what we consider to be a slow startup which we - // want to record stats for. - g_was_slow_startup = true; -} - -void OnInitialPageLoadComplete() { - if (!g_was_slow_startup) - return; - DCHECK(!g_startup_stats_collection_finished); - - const base::TimeDelta kStartupTimeMin( - base::TimeDelta::FromMilliseconds(1)); - const base::TimeDelta kStartupTimeMax(base::TimeDelta::FromMinutes(5)); - static const size_t kStartupTimeBuckets = 100; - - // Set UMA flag for histograms outside chrome/ that can't use the - // ScopedSlowStartupUMA class. - base::HistogramBase* histogram = - base::StatisticsRecorder::FindHistogram("Startup.SlowStartupNSSInit"); - if (histogram) - histogram->SetFlags(base::HistogramBase::kUmaTargetedHistogramFlag); - - // Iterate over the stats recorded by ScopedSlowStartupUMA and create - // histograms for them. - base::AutoLock locker(*GetSubsystemStartupTimeHashLock()); - SubsystemStartupTimeHash* time_hash = GetSubsystemStartupTimeHash(); - for (SubsystemStartupTimeHash::iterator i = time_hash->begin(); - i != time_hash->end(); - ++i) { - const std::string histogram_name = i->first; - base::HistogramBase* counter = base::Histogram::FactoryTimeGet( - histogram_name, - kStartupTimeMin, - kStartupTimeMax, - kStartupTimeBuckets, - base::Histogram::kUmaTargetedHistogramFlag); - counter->AddTime(i->second); - } - - g_startup_stats_collection_finished = true; } const base::Time* MainEntryPointTime() { @@ -385,18 +317,4 @@ const base::Time* MainEntryPointTime() { return MainEntryPointTimeInternal(); } -ScopedSlowStartupUMA::~ScopedSlowStartupUMA() { - if (g_startup_stats_collection_finished) - return; - - base::AutoLock locker(*GetSubsystemStartupTimeHashLock()); - SubsystemStartupTimeHash* hash = GetSubsystemStartupTimeHash(); - // Only record the initial sample for a given histogram. - if (hash->find(histogram_name_) != hash->end()) - return; - - (*hash)[histogram_name_] = - base::TimeTicks::Now() - start_time_; -} - } // namespace startup_metric_utils diff --git a/components/startup_metric_utils/startup_metric_utils.h b/components/startup_metric_utils/startup_metric_utils.h index 3f62947..952abf9 100644 --- a/components/startup_metric_utils/startup_metric_utils.h +++ b/components/startup_metric_utils/startup_metric_utils.h @@ -48,33 +48,11 @@ void RecordSavedMainEntryPointTime(const base::Time& entry_point_time); // |is_first_run| - is the current launch part of a first run. void OnBrowserStartupComplete(bool is_first_run); -// Called when the initial page load has finished in order to record startup -// stats. -void OnInitialPageLoadComplete(); - // Returns the time of main entry recorded from RecordMainEntryPointTime. // Returns NULL if that method has not yet been called. // This method is expected to be called from the UI thread. const base::Time* MainEntryPointTime(); -// Scoper that records the time period before it's destructed in a histogram -// with the given name. The histogram is only recorded for slow chrome startups. -// Useful for trying to figure out what parts of Chrome cause slow startup. -class ScopedSlowStartupUMA { - public: - explicit ScopedSlowStartupUMA(const std::string& histogram_name) - : start_time_(base::TimeTicks::Now()), - histogram_name_(histogram_name) {} - - ~ScopedSlowStartupUMA(); - - private: - const base::TimeTicks start_time_; - const std::string histogram_name_; - - DISALLOW_COPY_AND_ASSIGN(ScopedSlowStartupUMA); -}; - } // namespace startup_metric_utils #endif // COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_ diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc index df93160..125591c 100644 --- a/crypto/nss_util.cc +++ b/crypto/nss_util.cc @@ -37,7 +37,6 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" -#include "base/metrics/histogram.h" #include "base/native_library.h" #include "base/path_service.h" #include "base/stl_util.h" @@ -685,8 +684,6 @@ class NSSInitSingleton { initializing_tpm_token_(false), chaps_module_(NULL), root_(NULL) { - base::TimeTicks start_time = base::TimeTicks::Now(); - // It's safe to construct on any thread, since LazyInstance will prevent any // other threads from accessing until the constructor is done. thread_checker_.DetachFromThread(); @@ -783,14 +780,6 @@ class NSSInitSingleton { NSS_SetAlgorithmPolicy(SEC_OID_MD5, 0, NSS_USE_ALG_IN_CERT_SIGNATURE); NSS_SetAlgorithmPolicy(SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION, 0, NSS_USE_ALG_IN_CERT_SIGNATURE); - - // The UMA bit is conditionally set for this histogram in - // components/startup_metric_utils.cc . - LOCAL_HISTOGRAM_CUSTOM_TIMES("Startup.SlowStartupNSSInit", - base::TimeTicks::Now() - start_time, - base::TimeDelta::FromMilliseconds(10), - base::TimeDelta::FromHours(1), - 50); } // NOTE(willchan): We don't actually execute this code since we leak NSS to diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 39db40d..67b7301 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -41635,20 +41635,27 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. <histogram name="Startup.LoadTime.ExeMainToDllMain"> <owner>jeremy@chromium.org</owner> <summary> - Time from the main() function in chrome.exe to chrome.dll's main(). + Time from the main() function in chrome.exe to chrome.dll's main(). This + stat is only recorded after 7 minutes of OS uptime to try to mitigate the + variance resulting from Chrome being autostarted. </summary> </histogram> <histogram name="Startup.LoadTime.ProcessCreateToDllMain"> <owner>jeremy@chromium.org</owner> - <summary>Time from the process creation to chrome.dll's main().</summary> + <summary> + Time from the process creation to chrome.dll's main(). This stat is only + recorded after 7 minutes of OS uptime to try to mitigate the variance + resulting from Chrome being autostarted. + </summary> </histogram> <histogram name="Startup.LoadTime.ProcessCreateToExeMain"> <owner>jeremy@chromium.org</owner> <summary> Time from the process creation to executing the main() function in - chrome.exe. + chrome.exe. This stat is only recorded after 7 minutes of OS uptime to try + to mitigate the variance resulting from Chrome being autostarted. </summary> </histogram> @@ -41778,6 +41785,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. </histogram> <histogram name="Startup.SlowStartupBookmarksLoad" units="milliseconds"> + <obsolete> + Deprecated 06/2015. + </obsolete> <owner>jeremy@chromium.org</owner> <summary> Time it takes to load bookmarks from disk. This measurement is only sent for @@ -41787,6 +41797,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. <histogram name="Startup.SlowStartupExtensionServiceInitAfterImport" units="milliseconds"> + <obsolete> + Deprecated 06/2015. + </obsolete> <owner>jeremy@chromium.org</owner> <summary> Time it takes to finish initialization of the extension service including @@ -41796,6 +41809,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. </histogram> <histogram name="Startup.SlowStartupFinalProfileInit" units="milliseconds"> + <obsolete> + Deprecated 06/2015. + </obsolete> <owner>jeremy@chromium.org</owner> <summary> Time the final stages of profile initialization taking including @@ -41805,6 +41821,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. </histogram> <histogram name="Startup.SlowStartupNSSInit" units="milliseconds"> + <obsolete> + Deprecated 06/2015. + </obsolete> <owner>jeremy@chromium.org</owner> <summary> Time it takes to load the NSS libraries and initialize it. This measurement @@ -41814,6 +41833,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. </histogram> <histogram name="Startup.SlowStartupPreferenceLoading" units="milliseconds"> + <obsolete> + Deprecated 06/2015. + </obsolete> <owner>jeremy@chromium.org</owner> <summary> Time it takes to load preferences from disk. This measurement is only sent @@ -41822,6 +41844,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. </histogram> <histogram name="Startup.SlowStartupProfileIODataInit" units="milliseconds"> + <obsolete> + Deprecated 06/2015. + </obsolete> <owner>jeremy@chromium.org</owner> <summary> Time it takes to initialize the ProfileIOData object - this includes @@ -41832,6 +41857,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. <histogram name="Startup.SlowStartupSafeBrowsingGetDatabase" units="milliseconds"> + <obsolete> + Deprecated 06/2015. + </obsolete> <owner>jeremy@chromium.org</owner> <summary> Time it takes to load the safe browsing database from disk. This measurement @@ -41842,6 +41870,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. <histogram name="Startup.SlowStartupSafeBrowsingServiceInitialize" units="milliseconds"> + <obsolete> + Deprecated 06/2015. + </obsolete> <owner>jeremy@chromium.org</owner> <summary> Time it takes to initialize the safe browsing service. This measurement is @@ -41852,6 +41883,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. <histogram name="Startup.SlowStartupSessionServiceCreateTabsAndWindows" units="milliseconds"> + <obsolete> + Deprecated 06/2015. + </obsolete> <owner>jeremy@chromium.org</owner> <summary> Time it takes for session restore to finish initiating creation of restored |