Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/metrics/chrome_stability_metrics_provider.h" | 5 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/metrics/sparse_histogram.h" | 11 #include "base/metrics/sparse_histogram.h" |
| 12 #include "base/prefs/pref_registry_simple.h" | 12 #include "base/prefs/pref_registry_simple.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
| 17 #include "chrome/common/chrome_result_codes.h" | |
| 17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 18 #include "components/metrics/proto/system_profile.pb.h" | 19 #include "components/metrics/proto/system_profile.pb.h" |
| 19 #include "content/public/browser/child_process_data.h" | 20 #include "content/public/browser/child_process_data.h" |
| 20 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 21 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 22 #include "content/public/browser/user_metrics.h" | 23 #include "content/public/browser/user_metrics.h" |
| 23 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
| 24 | 25 |
| 25 #if defined(ENABLE_EXTENSIONS) | 26 #if defined(ENABLE_EXTENSIONS) |
| 26 #include "extensions/browser/process_map.h" | 27 #include "extensions/browser/process_map.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 // Converts an exit code into something that can be inserted into our | 60 // Converts an exit code into something that can be inserted into our |
| 60 // histograms (which expect non-negative numbers less than MAX_INT). | 61 // histograms (which expect non-negative numbers less than MAX_INT). |
| 61 int MapCrashExitCodeForHistogram(int exit_code) { | 62 int MapCrashExitCodeForHistogram(int exit_code) { |
| 62 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
| 63 // Since |abs(STATUS_GUARD_PAGE_VIOLATION) == MAX_INT| it causes problems in | 64 // Since |abs(STATUS_GUARD_PAGE_VIOLATION) == MAX_INT| it causes problems in |
| 64 // histograms.cc. Solve this by remapping it to a smaller value, which | 65 // histograms.cc. Solve this by remapping it to a smaller value, which |
| 65 // hopefully doesn't conflict with other codes. | 66 // hopefully doesn't conflict with other codes. |
| 66 if (exit_code == STATUS_GUARD_PAGE_VIOLATION) | 67 if (exit_code == STATUS_GUARD_PAGE_VIOLATION) |
| 67 return 0x1FCF7EC3; // Randomly picked number. | 68 return 0x1FCF7EC3; // Randomly picked number. |
| 68 #endif | 69 #endif |
| 69 | |
|
Alexei Svitkine (slow)
2015/08/31 19:06:14
Nit: Remove spurious change.
Will Harris
2015/09/01 01:15:38
Done.
| |
| 70 return std::abs(exit_code); | 70 return std::abs(exit_code); |
| 71 } | 71 } |
| 72 | 72 |
| 73 #if defined(OS_WIN) | 73 #if defined(OS_WIN) |
| 74 void CountBrowserCrashDumpAttempts() { | 74 void CountBrowserCrashDumpAttempts() { |
| 75 enum Outcome { | 75 enum Outcome { |
| 76 OUTCOME_SUCCESS, | 76 OUTCOME_SUCCESS, |
| 77 OUTCOME_FAILURE, | 77 OUTCOME_FAILURE, |
| 78 OUTCOME_UNKNOWN, | 78 OUTCOME_UNKNOWN, |
| 79 OUTCOME_MAX_VALUE | 79 OUTCOME_MAX_VALUE |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 was_extension_process ? 2 : 1, | 303 was_extension_process ? 2 : 1, |
| 304 3); | 304 3); |
| 305 memory::RecordMemoryStats( | 305 memory::RecordMemoryStats( |
| 306 was_extension_process | 306 was_extension_process |
| 307 ? memory::RECORD_MEMORY_STATS_EXTENSIONS_OOM_KILLED | 307 ? memory::RECORD_MEMORY_STATS_EXTENSIONS_OOM_KILLED |
| 308 : memory::RECORD_MEMORY_STATS_CONTENTS_OOM_KILLED); | 308 : memory::RECORD_MEMORY_STATS_CONTENTS_OOM_KILLED); |
| 309 #endif | 309 #endif |
| 310 } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) { | 310 } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) { |
| 311 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.DisconnectedAlive", | 311 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.DisconnectedAlive", |
| 312 was_extension_process ? 2 : 1); | 312 was_extension_process ? 2 : 1); |
| 313 } else if (status == base::TERMINATION_STATUS_LAUNCH_FAILED) { | |
| 314 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildLaunchFailures", | |
| 315 was_extension_process ? 2 : 1); | |
|
Alexei Svitkine (slow)
2015/08/31 19:06:14
Hmm, this macro shouldn't be using UMA_HISTOGRAM_P
Will Harris
2015/09/01 01:15:38
Done.
| |
| 316 // Treat child process launch as a crash for now. | |
| 317 if (was_extension_process) | |
| 318 IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount); | |
| 319 else | |
| 320 IncrementPrefValue(prefs::kStabilityRendererCrashCount); | |
| 313 } | 321 } |
| 322 | |
| 314 } | 323 } |
| 315 | 324 |
| 316 void ChromeStabilityMetricsProvider::LogRendererHang() { | 325 void ChromeStabilityMetricsProvider::LogRendererHang() { |
| 317 IncrementPrefValue(prefs::kStabilityRendererHangCount); | 326 IncrementPrefValue(prefs::kStabilityRendererHangCount); |
| 318 } | 327 } |
| OLD | NEW |