Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 5 |
| 6 | 6 |
| 7 //------------------------------------------------------------------------------ | 7 //------------------------------------------------------------------------------ |
| 8 // Description of the life cycle of a instance of MetricsService. | 8 // Description of the life cycle of a instance of MetricsService. |
| 9 // | 9 // |
| 10 // OVERVIEW | 10 // OVERVIEW |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 local_state->RegisterStringPref(prefs::kStabilityStatsVersion, L""); | 324 local_state->RegisterStringPref(prefs::kStabilityStatsVersion, L""); |
| 325 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); | 325 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); |
| 326 local_state->RegisterBooleanPref(prefs::kStabilitySessionEndCompleted, true); | 326 local_state->RegisterBooleanPref(prefs::kStabilitySessionEndCompleted, true); |
| 327 local_state->RegisterIntegerPref(prefs::kMetricsSessionID, -1); | 327 local_state->RegisterIntegerPref(prefs::kMetricsSessionID, -1); |
| 328 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); | 328 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); |
| 329 local_state->RegisterIntegerPref(prefs::kStabilityCrashCount, 0); | 329 local_state->RegisterIntegerPref(prefs::kStabilityCrashCount, 0); |
| 330 local_state->RegisterIntegerPref(prefs::kStabilityIncompleteSessionEndCount, | 330 local_state->RegisterIntegerPref(prefs::kStabilityIncompleteSessionEndCount, |
| 331 0); | 331 0); |
| 332 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); | 332 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); |
| 333 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 333 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
| 334 local_state->RegisterIntegerPref(prefs::kStabilityExtensionRendererCrashCount, | |
| 335 0); | |
| 334 local_state->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0); | 336 local_state->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0); |
| 337 local_state->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0); | |
| 335 local_state->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationFail, | 338 local_state->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationFail, |
| 336 0); | 339 0); |
| 337 local_state->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationSuccess, | 340 local_state->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationSuccess, |
| 338 0); | 341 0); |
| 339 local_state->RegisterIntegerPref(prefs::kStabilityDebuggerPresent, 0); | 342 local_state->RegisterIntegerPref(prefs::kStabilityDebuggerPresent, 0); |
| 340 local_state->RegisterIntegerPref(prefs::kStabilityDebuggerNotPresent, 0); | 343 local_state->RegisterIntegerPref(prefs::kStabilityDebuggerNotPresent, 0); |
| 341 | 344 |
| 342 local_state->RegisterDictionaryPref(prefs::kProfileMetrics); | 345 local_state->RegisterDictionaryPref(prefs::kProfileMetrics); |
| 343 local_state->RegisterIntegerPref(prefs::kNumBookmarksOnBookmarkBar, 0); | 346 local_state->RegisterIntegerPref(prefs::kNumBookmarksOnBookmarkBar, 0); |
| 344 local_state->RegisterIntegerPref(prefs::kNumFoldersOnBookmarkBar, 0); | 347 local_state->RegisterIntegerPref(prefs::kNumFoldersOnBookmarkBar, 0); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 551 | 554 |
| 552 case NotificationType::LOAD_STOP: | 555 case NotificationType::LOAD_STOP: |
| 553 LogLoadComplete(type, source, details); | 556 LogLoadComplete(type, source, details); |
| 554 break; | 557 break; |
| 555 | 558 |
| 556 case NotificationType::LOAD_START: | 559 case NotificationType::LOAD_START: |
| 557 LogLoadStarted(); | 560 LogLoadStarted(); |
| 558 break; | 561 break; |
| 559 | 562 |
| 560 case NotificationType::RENDERER_PROCESS_CLOSED: | 563 case NotificationType::RENDERER_PROCESS_CLOSED: |
| 561 if (*Details<bool>(details).ptr()) | 564 { |
| 562 LogRendererCrash(); | 565 RenderProcessHost::RendererClosedDetails* process_details = |
| 566 Details<RenderProcessHost::RendererClosedDetails>(details).ptr(); | |
| 567 if (process_details->did_crash) { | |
| 568 if (process_details->was_extension_renderer) { | |
| 569 LogExtensionRendererCrash(); | |
| 570 } else { | |
| 571 LogRendererCrash(); | |
| 572 } | |
| 573 } | |
| 574 } | |
| 563 break; | 575 break; |
| 564 | 576 |
| 565 case NotificationType::RENDERER_PROCESS_HANG: | 577 case NotificationType::RENDERER_PROCESS_HANG: |
| 566 LogRendererHang(); | 578 LogRendererHang(); |
| 567 break; | 579 break; |
| 568 | 580 |
| 569 case NotificationType::CHILD_PROCESS_HOST_CONNECTED: | 581 case NotificationType::CHILD_PROCESS_HOST_CONNECTED: |
| 570 case NotificationType::CHILD_PROCESS_CRASHED: | 582 case NotificationType::CHILD_PROCESS_CRASHED: |
| 571 case NotificationType::CHILD_INSTANCE_CREATED: | 583 case NotificationType::CHILD_INSTANCE_CREATED: |
| 572 LogChildProcessChange(type, source, details); | 584 LogChildProcessChange(type, source, details); |
| (...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1658 IncrementPrefValue(prefs::kStabilityPageLoadCount); | 1670 IncrementPrefValue(prefs::kStabilityPageLoadCount); |
| 1659 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); | 1671 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); |
| 1660 // We need to save the prefs, as page load count is a critical stat, and it | 1672 // We need to save the prefs, as page load count is a critical stat, and it |
| 1661 // might be lost due to a crash :-(. | 1673 // might be lost due to a crash :-(. |
| 1662 } | 1674 } |
| 1663 | 1675 |
| 1664 void MetricsService::LogRendererCrash() { | 1676 void MetricsService::LogRendererCrash() { |
| 1665 IncrementPrefValue(prefs::kStabilityRendererCrashCount); | 1677 IncrementPrefValue(prefs::kStabilityRendererCrashCount); |
| 1666 } | 1678 } |
| 1667 | 1679 |
| 1680 void MetricsService::LogExtensionRendererCrash() { | |
| 1681 IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount); | |
| 1682 } | |
| 1683 | |
| 1668 void MetricsService::LogRendererHang() { | 1684 void MetricsService::LogRendererHang() { |
| 1669 IncrementPrefValue(prefs::kStabilityRendererHangCount); | 1685 IncrementPrefValue(prefs::kStabilityRendererHangCount); |
| 1670 } | 1686 } |
| 1671 | 1687 |
| 1672 void MetricsService::LogChildProcessChange( | 1688 void MetricsService::LogChildProcessChange( |
| 1673 NotificationType type, | 1689 NotificationType type, |
| 1674 const NotificationSource& source, | 1690 const NotificationSource& source, |
| 1675 const NotificationDetails& details) { | 1691 const NotificationDetails& details) { |
| 1676 Details<ChildProcessInfo> child_details(details); | 1692 Details<ChildProcessInfo> child_details(details); |
| 1677 const std::wstring& child_name = child_details->name(); | 1693 const std::wstring& child_name = child_details->name(); |
| 1678 | 1694 |
| 1679 | |
| 1680 if (child_process_stats_buffer_.find(child_name) == | 1695 if (child_process_stats_buffer_.find(child_name) == |
| 1681 child_process_stats_buffer_.end()) { | 1696 child_process_stats_buffer_.end()) { |
| 1682 child_process_stats_buffer_[child_name] = | 1697 child_process_stats_buffer_[child_name] = |
| 1683 ChildProcessStats(child_details->type()); | 1698 ChildProcessStats(child_details->type()); |
| 1684 } | 1699 } |
| 1685 | 1700 |
| 1686 ChildProcessStats& stats = child_process_stats_buffer_[child_name]; | 1701 ChildProcessStats& stats = child_process_stats_buffer_[child_name]; |
| 1687 switch (type.value) { | 1702 switch (type.value) { |
| 1688 case NotificationType::CHILD_PROCESS_HOST_CONNECTED: | 1703 case NotificationType::CHILD_PROCESS_HOST_CONNECTED: |
| 1689 stats.process_launches++; | 1704 stats.process_launches++; |
| 1690 break; | 1705 break; |
| 1691 | 1706 |
| 1692 case NotificationType::CHILD_INSTANCE_CREATED: | 1707 case NotificationType::CHILD_INSTANCE_CREATED: |
| 1693 stats.instances++; | 1708 stats.instances++; |
| 1694 break; | 1709 break; |
| 1695 | 1710 |
| 1696 case NotificationType::CHILD_PROCESS_CRASHED: | 1711 case NotificationType::CHILD_PROCESS_CRASHED: |
| 1697 stats.process_crashes++; | 1712 stats.process_crashes++; |
| 1713 // Exclude plugin crashes from the count below because we report them via | |
| 1714 // a separate UMA metric. | |
| 1715 if (child_details->type() != ChildProcessInfo::PLUGIN_PROCESS) { | |
|
jar (doing other things)
2009/12/18 16:28:14
There is a surprising asymmetry in this code. I'd
asargent_no_longer_on_chrome
2010/01/05 01:01:19
The cause of this weirdness is probably that the s
| |
| 1716 IncrementPrefValue(prefs::kStabilityChildProcessCrashCount); | |
| 1717 } | |
| 1698 break; | 1718 break; |
| 1699 | 1719 |
| 1700 default: | 1720 default: |
| 1701 NOTREACHED() << "Unexpected notification type " << type.value; | 1721 NOTREACHED() << "Unexpected notification type " << type.value; |
| 1702 return; | 1722 return; |
| 1703 } | 1723 } |
| 1704 } | 1724 } |
| 1705 | 1725 |
| 1706 // Recursively counts the number of bookmarks and folders in node. | 1726 // Recursively counts the number of bookmarks and folders in node. |
| 1707 static void CountBookmarks(const BookmarkNode* node, | 1727 static void CountBookmarks(const BookmarkNode* node, |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1900 thread_id = PlatformThread::CurrentId(); | 1920 thread_id = PlatformThread::CurrentId(); |
| 1901 return PlatformThread::CurrentId() == thread_id; | 1921 return PlatformThread::CurrentId() == thread_id; |
| 1902 } | 1922 } |
| 1903 | 1923 |
| 1904 #if defined(OS_CHROMEOS) | 1924 #if defined(OS_CHROMEOS) |
| 1905 void MetricsService::StartExternalMetrics(Profile* profile) { | 1925 void MetricsService::StartExternalMetrics(Profile* profile) { |
| 1906 external_metrics_ = new chromeos::ExternalMetrics; | 1926 external_metrics_ = new chromeos::ExternalMetrics; |
| 1907 external_metrics_->Start(profile); | 1927 external_metrics_->Start(profile); |
| 1908 } | 1928 } |
| 1909 #endif | 1929 #endif |
| OLD | NEW |