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

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

Issue 1320153002: Add new termination status for failed launch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | chrome/common/chrome_result_codes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 70 if (exit_code == -1)
71 return chrome::RESULT_CODE_RENDERER_PROCESS_START_FAILURE;
70 return std::abs(exit_code); 72 return std::abs(exit_code);
71 } 73 }
72 74
73 #if defined(OS_WIN) 75 #if defined(OS_WIN)
74 void CountBrowserCrashDumpAttempts() { 76 void CountBrowserCrashDumpAttempts() {
75 enum Outcome { 77 enum Outcome {
76 OUTCOME_SUCCESS, 78 OUTCOME_SUCCESS,
77 OUTCOME_FAILURE, 79 OUTCOME_FAILURE,
78 OUTCOME_UNKNOWN, 80 OUTCOME_UNKNOWN,
79 OUTCOME_MAX_VALUE 81 OUTCOME_MAX_VALUE
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 content::RenderProcessHost* host, 274 content::RenderProcessHost* host,
273 base::TerminationStatus status, 275 base::TerminationStatus status,
274 int exit_code) { 276 int exit_code) {
275 bool was_extension_process = false; 277 bool was_extension_process = false;
276 #if defined(ENABLE_EXTENSIONS) 278 #if defined(ENABLE_EXTENSIONS)
277 was_extension_process = 279 was_extension_process =
278 extensions::ProcessMap::Get(host->GetBrowserContext())->Contains( 280 extensions::ProcessMap::Get(host->GetBrowserContext())->Contains(
279 host->GetID()); 281 host->GetID());
280 #endif 282 #endif
281 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED || 283 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED ||
282 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { 284 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION ||
285 (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED &&
Alexei Svitkine (slow) 2015/08/28 16:45:50 Probably worth adding a unit test for - e.g. call
Will Harris 2015/09/01 01:15:38 Done.
286 exit_code == -1)) {
Will Harris 2015/08/28 16:41:11 reviewer note: this error code comes from RenderP
Alexei Svitkine (slow) 2015/08/28 16:45:50 Can this be made a constant that both places can r
Will Harris 2015/08/28 16:52:13 render_process_host_impl.cc is in content so I'd h
jam 2015/08/28 17:18:35 It seems a pseudo code can be in both modules. Sin
283 if (was_extension_process) { 287 if (was_extension_process) {
284 IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount); 288 IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount);
285 289
286 UMA_HISTOGRAM_SPARSE_SLOWLY("CrashExitCodes.Extension", 290 UMA_HISTOGRAM_SPARSE_SLOWLY("CrashExitCodes.Extension",
287 MapCrashExitCodeForHistogram(exit_code)); 291 MapCrashExitCodeForHistogram(exit_code));
288 } else { 292 } else {
289 IncrementPrefValue(prefs::kStabilityRendererCrashCount); 293 IncrementPrefValue(prefs::kStabilityRendererCrashCount);
290 294
291 UMA_HISTOGRAM_SPARSE_SLOWLY("CrashExitCodes.Renderer", 295 UMA_HISTOGRAM_SPARSE_SLOWLY("CrashExitCodes.Renderer",
292 MapCrashExitCodeForHistogram(exit_code)); 296 MapCrashExitCodeForHistogram(exit_code));
(...skipping 16 matching lines...) Expand all
309 #endif 313 #endif
310 } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) { 314 } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) {
311 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.DisconnectedAlive", 315 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.DisconnectedAlive",
312 was_extension_process ? 2 : 1); 316 was_extension_process ? 2 : 1);
313 } 317 }
314 } 318 }
315 319
316 void ChromeStabilityMetricsProvider::LogRendererHang() { 320 void ChromeStabilityMetricsProvider::LogRendererHang() {
317 IncrementPrefValue(prefs::kStabilityRendererHangCount); 321 IncrementPrefValue(prefs::kStabilityRendererHangCount);
318 } 322 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_result_codes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698