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

Side by Side Diff: chromecast/browser/metrics/cast_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: rebase and a nit. 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
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 "chromecast/browser/metrics/cast_stability_metrics_provider.h" 5 #include "chromecast/browser/metrics/cast_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 "chromecast/base/pref_names.h" 14 #include "chromecast/base/pref_names.h"
15 #include "chromecast/browser/cast_browser_process.h" 15 #include "chromecast/browser/cast_browser_process.h"
16 #include "chromecast/browser/metrics/cast_metrics_service_client.h" 16 #include "chromecast/browser/metrics/cast_metrics_service_client.h"
17 #include "components/metrics/metrics_service.h" 17 #include "components/metrics/metrics_service.h"
18 #include "components/metrics/proto/system_profile.pb.h" 18 #include "components/metrics/proto/system_profile.pb.h"
19 #include "content/public/browser/child_process_data.h" 19 #include "content/public/browser/child_process_data.h"
20 #include "content/public/browser/navigation_controller.h" 20 #include "content/public/browser/navigation_controller.h"
21 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/notification_types.h" 22 #include "content/public/browser/notification_types.h"
23 #include "content/public/browser/render_process_host.h" 23 #include "content/public/browser/render_process_host.h"
24 24
25 namespace chromecast { 25 namespace chromecast {
26 namespace metrics { 26 namespace metrics {
27 27
28 namespace { 28 namespace {
29 29
30 enum RendererType {
31 RENDERER_TYPE_RENDERER,
32 RENDERER_TYPE_EXTENSION, // Not used, but needed for correct histogram count.
33 // NOTE: Add new action types only immediately above this line. Also,
34 // make sure the enum list in tools/metrics/histograms/histograms.xml is
35 // updated with any change in here.
36 RENDERER_TYPE_COUNT
37 };
38
30 void IncrementPrefValue(const char* path) { 39 void IncrementPrefValue(const char* path) {
31 PrefService* pref = shell::CastBrowserProcess::GetInstance()->pref_service(); 40 PrefService* pref = shell::CastBrowserProcess::GetInstance()->pref_service();
32 DCHECK(pref); 41 DCHECK(pref);
33 int value = pref->GetInteger(path); 42 int value = pref->GetInteger(path);
34 pref->SetInteger(path, value + 1); 43 pref->SetInteger(path, value + 1);
35 } 44 }
36 45
37 // Converts an exit code into something that can be inserted into our 46 // Converts an exit code into something that can be inserted into our
38 // histograms (which expect non-negative numbers less than MAX_INT). 47 // histograms (which expect non-negative numbers less than MAX_INT).
39 int MapCrashExitCodeForHistogram(int exit_code) { 48 int MapCrashExitCodeForHistogram(int exit_code) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 void CastStabilityMetricsProvider::LogRendererCrash( 157 void CastStabilityMetricsProvider::LogRendererCrash(
149 content::RenderProcessHost* host, 158 content::RenderProcessHost* host,
150 base::TerminationStatus status, 159 base::TerminationStatus status,
151 int exit_code) { 160 int exit_code) {
152 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED || 161 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED ||
153 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { 162 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) {
154 IncrementPrefValue(prefs::kStabilityRendererCrashCount); 163 IncrementPrefValue(prefs::kStabilityRendererCrashCount);
155 164
156 UMA_HISTOGRAM_SPARSE_SLOWLY("CrashExitCodes.Renderer", 165 UMA_HISTOGRAM_SPARSE_SLOWLY("CrashExitCodes.Renderer",
157 MapCrashExitCodeForHistogram(exit_code)); 166 MapCrashExitCodeForHistogram(exit_code));
158 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes", 1); 167 UMA_HISTOGRAM_ENUMERATION("BrowserRenderProcessHost.ChildCrashes",
168 RENDERER_TYPE_RENDERER, RENDERER_TYPE_COUNT);
159 } else if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { 169 } else if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) {
160 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildKills", 1); 170 UMA_HISTOGRAM_ENUMERATION("BrowserRenderProcessHost.ChildKills",
171 RENDERER_TYPE_RENDERER, RENDERER_TYPE_COUNT);
161 } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) { 172 } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) {
162 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.DisconnectedAlive", 1); 173 UMA_HISTOGRAM_ENUMERATION("BrowserRenderProcessHost.DisconnectedAlive",
174 RENDERER_TYPE_RENDERER, RENDERER_TYPE_COUNT);
175 } else if (status == base::TERMINATION_STATUS_LAUNCH_FAILED) {
176 IncrementPrefValue(prefs::kStabilityRendererCrashCount);
163 } 177 }
164 } 178 }
165 179
166 void CastStabilityMetricsProvider::LogRendererHang() { 180 void CastStabilityMetricsProvider::LogRendererHang() {
167 IncrementPrefValue(prefs::kStabilityRendererHangCount); 181 IncrementPrefValue(prefs::kStabilityRendererHangCount);
168 } 182 }
169 183
170 } // namespace metrics 184 } // namespace metrics
171 } // namespace chromecast 185 } // namespace chromecast
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome_launcher.cc ('k') | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698