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

Side by Side Diff: chrome/browser/metrics/metrics_service.cc

Issue 108683003: Store gpu crashes in the systemprofileproto (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Alexei comments1 Created 7 years 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 (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 //------------------------------------------------------------------------------ 5 //------------------------------------------------------------------------------
6 // Description of the life cycle of a instance of MetricsService. 6 // Description of the life cycle of a instance of MetricsService.
7 // 7 //
8 // OVERVIEW 8 // OVERVIEW
9 // 9 //
10 // A MetricsService instance is typically created at application startup. It is 10 // A MetricsService instance is typically created at application startup. It is
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); 439 registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
440 registry->RegisterIntegerPref(prefs::kStabilityExtensionRendererCrashCount, 440 registry->RegisterIntegerPref(prefs::kStabilityExtensionRendererCrashCount,
441 0); 441 0);
442 registry->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0); 442 registry->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0);
443 registry->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0); 443 registry->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0);
444 registry->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationFail, 0); 444 registry->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationFail, 0);
445 registry->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationSuccess, 445 registry->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationSuccess,
446 0); 446 0);
447 registry->RegisterIntegerPref(prefs::kStabilityDebuggerPresent, 0); 447 registry->RegisterIntegerPref(prefs::kStabilityDebuggerPresent, 0);
448 registry->RegisterIntegerPref(prefs::kStabilityDebuggerNotPresent, 0); 448 registry->RegisterIntegerPref(prefs::kStabilityDebuggerNotPresent, 0);
449 registry->RegisterIntegerPref(prefs::kStabilityGpuCrashCount, 0);
449 #if defined(OS_CHROMEOS) 450 #if defined(OS_CHROMEOS)
450 registry->RegisterIntegerPref(prefs::kStabilityOtherUserCrashCount, 0); 451 registry->RegisterIntegerPref(prefs::kStabilityOtherUserCrashCount, 0);
451 registry->RegisterIntegerPref(prefs::kStabilityKernelCrashCount, 0); 452 registry->RegisterIntegerPref(prefs::kStabilityKernelCrashCount, 0);
452 registry->RegisterIntegerPref(prefs::kStabilitySystemUncleanShutdownCount, 0); 453 registry->RegisterIntegerPref(prefs::kStabilitySystemUncleanShutdownCount, 0);
453 #endif // OS_CHROMEOS 454 #endif // OS_CHROMEOS
454 455
455 registry->RegisterStringPref(prefs::kStabilitySavedSystemProfile, 456 registry->RegisterStringPref(prefs::kStabilitySavedSystemProfile,
456 std::string()); 457 std::string());
457 registry->RegisterStringPref(prefs::kStabilitySavedSystemProfileHash, 458 registry->RegisterStringPref(prefs::kStabilitySavedSystemProfileHash,
458 std::string()); 459 std::string());
(...skipping 20 matching lines...) Expand all
479 local_state->SetInteger(prefs::kStabilityBreakpadRegistrationFail, 0); 480 local_state->SetInteger(prefs::kStabilityBreakpadRegistrationFail, 0);
480 local_state->SetInteger(prefs::kStabilityDebuggerPresent, 0); 481 local_state->SetInteger(prefs::kStabilityDebuggerPresent, 0);
481 local_state->SetInteger(prefs::kStabilityDebuggerNotPresent, 0); 482 local_state->SetInteger(prefs::kStabilityDebuggerNotPresent, 0);
482 483
483 local_state->SetInteger(prefs::kStabilityLaunchCount, 0); 484 local_state->SetInteger(prefs::kStabilityLaunchCount, 0);
484 local_state->SetInteger(prefs::kStabilityCrashCount, 0); 485 local_state->SetInteger(prefs::kStabilityCrashCount, 0);
485 486
486 local_state->SetInteger(prefs::kStabilityPageLoadCount, 0); 487 local_state->SetInteger(prefs::kStabilityPageLoadCount, 0);
487 local_state->SetInteger(prefs::kStabilityRendererCrashCount, 0); 488 local_state->SetInteger(prefs::kStabilityRendererCrashCount, 0);
488 local_state->SetInteger(prefs::kStabilityRendererHangCount, 0); 489 local_state->SetInteger(prefs::kStabilityRendererHangCount, 0);
490 local_state->SetInteger(prefs::kStabilityGpuCrashCount, 0);
489 491
490 local_state->SetInt64(prefs::kStabilityLaunchTimeSec, 0); 492 local_state->SetInt64(prefs::kStabilityLaunchTimeSec, 0);
491 local_state->SetInt64(prefs::kStabilityLastTimestampSec, 0); 493 local_state->SetInt64(prefs::kStabilityLastTimestampSec, 0);
492 494
493 local_state->ClearPref(prefs::kStabilityPluginStats); 495 local_state->ClearPref(prefs::kStabilityPluginStats);
494 496
495 local_state->ClearPref(prefs::kMetricsInitialLogs); 497 local_state->ClearPref(prefs::kMetricsInitialLogs);
496 local_state->ClearPref(prefs::kMetricsOngoingLogs); 498 local_state->ClearPref(prefs::kMetricsOngoingLogs);
497 } 499 }
498 500
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 registrar->Add(observer, chrome::NOTIFICATION_TAB_PARENTED, 670 registrar->Add(observer, chrome::NOTIFICATION_TAB_PARENTED,
669 content::NotificationService::AllSources()); 671 content::NotificationService::AllSources());
670 registrar->Add(observer, chrome::NOTIFICATION_TAB_CLOSING, 672 registrar->Add(observer, chrome::NOTIFICATION_TAB_CLOSING,
671 content::NotificationService::AllSources()); 673 content::NotificationService::AllSources());
672 registrar->Add(observer, content::NOTIFICATION_LOAD_START, 674 registrar->Add(observer, content::NOTIFICATION_LOAD_START,
673 content::NotificationService::AllSources()); 675 content::NotificationService::AllSources());
674 registrar->Add(observer, content::NOTIFICATION_LOAD_STOP, 676 registrar->Add(observer, content::NOTIFICATION_LOAD_STOP,
675 content::NotificationService::AllSources()); 677 content::NotificationService::AllSources());
676 registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 678 registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
677 content::NotificationService::AllSources()); 679 content::NotificationService::AllSources());
680 registrar->Add(observer, content::NOTIFICATION_GPU_PROCESS_CLOSED_ABNORMALLY,
681 content::NotificationService::AllSources());
678 registrar->Add(observer, content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, 682 registrar->Add(observer, content::NOTIFICATION_RENDER_WIDGET_HOST_HANG,
679 content::NotificationService::AllSources()); 683 content::NotificationService::AllSources());
680 registrar->Add(observer, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, 684 registrar->Add(observer, chrome::NOTIFICATION_OMNIBOX_OPENED_URL,
681 content::NotificationService::AllSources()); 685 content::NotificationService::AllSources());
682 } 686 }
683 687
684 void MetricsService::BrowserChildProcessHostConnected( 688 void MetricsService::BrowserChildProcessHostConnected(
685 const content::ChildProcessData& data) { 689 const content::ChildProcessData& data) {
686 GetChildProcessStats(data).process_launches++; 690 GetChildProcessStats(data).process_launches++;
687 } 691 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 748
745 case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: { 749 case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: {
746 MetricsLog* current_log = 750 MetricsLog* current_log =
747 static_cast<MetricsLog*>(log_manager_.current_log()); 751 static_cast<MetricsLog*>(log_manager_.current_log());
748 DCHECK(current_log); 752 DCHECK(current_log);
749 current_log->RecordOmniboxOpenedURL( 753 current_log->RecordOmniboxOpenedURL(
750 *content::Details<OmniboxLog>(details).ptr()); 754 *content::Details<OmniboxLog>(details).ptr());
751 break; 755 break;
752 } 756 }
753 757
758 case content::NOTIFICATION_GPU_PROCESS_CLOSED_ABNORMALLY:
759 LogGpuCrash();
760 break;
761
754 default: 762 default:
755 NOTREACHED(); 763 NOTREACHED();
756 break; 764 break;
757 } 765 }
758 766
759 HandleIdleSinceLastTransmission(false); 767 HandleIdleSinceLastTransmission(false);
760 } 768 }
761 769
762 void MetricsService::HandleIdleSinceLastTransmission(bool in_idle) { 770 void MetricsService::HandleIdleSinceLastTransmission(bool in_idle) {
763 // If there wasn't a lot of action, maybe the computer was asleep, in which 771 // If there wasn't a lot of action, maybe the computer was asleep, in which
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 process_type == content::PROCESS_TYPE_PPAPI_BROKER); 1926 process_type == content::PROCESS_TYPE_PPAPI_BROKER);
1919 } 1927 }
1920 1928
1921 #if defined(OS_CHROMEOS) 1929 #if defined(OS_CHROMEOS)
1922 void MetricsService::StartExternalMetrics() { 1930 void MetricsService::StartExternalMetrics() {
1923 external_metrics_ = new chromeos::ExternalMetrics; 1931 external_metrics_ = new chromeos::ExternalMetrics;
1924 external_metrics_->Start(); 1932 external_metrics_->Start();
1925 } 1933 }
1926 #endif 1934 #endif
1927 1935
1936 void MetricsService::LogGpuCrash() {
1937 IncrementPrefValue(prefs::kStabilityGpuCrashCount);
1938 }
1939
1928 // static 1940 // static
1929 bool MetricsServiceHelper::IsMetricsReportingEnabled() { 1941 bool MetricsServiceHelper::IsMetricsReportingEnabled() {
1930 bool result = false; 1942 bool result = false;
1931 const PrefService* local_state = g_browser_process->local_state(); 1943 const PrefService* local_state = g_browser_process->local_state();
1932 if (local_state) { 1944 if (local_state) {
1933 const PrefService::Preference* uma_pref = 1945 const PrefService::Preference* uma_pref =
1934 local_state->FindPreference(prefs::kMetricsReportingEnabled); 1946 local_state->FindPreference(prefs::kMetricsReportingEnabled);
1935 if (uma_pref) { 1947 if (uma_pref) {
1936 bool success = uma_pref->GetValue()->GetAsBoolean(&result); 1948 bool success = uma_pref->GetValue()->GetAsBoolean(&result);
1937 DCHECK(success); 1949 DCHECK(success);
1938 } 1950 }
1939 } 1951 }
1940 return result; 1952 return result;
1941 } 1953 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698