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

Side by Side Diff: components/metrics/stability_metrics_helper.cc

Issue 2130753004: Add renderer launch count to stability metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do not report on chromecast Created 4 years, 5 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 | « components/metrics/stability_metrics_helper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/metrics/stability_metrics_helper.h" 5 #include "components/metrics/stability_metrics_helper.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 stability_proto->set_renderer_crash_count(count); 88 stability_proto->set_renderer_crash_count(count);
89 local_state_->SetInteger(prefs::kStabilityRendererCrashCount, 0); 89 local_state_->SetInteger(prefs::kStabilityRendererCrashCount, 0);
90 } 90 }
91 91
92 count = local_state_->GetInteger(prefs::kStabilityRendererFailedLaunchCount); 92 count = local_state_->GetInteger(prefs::kStabilityRendererFailedLaunchCount);
93 if (count) { 93 if (count) {
94 stability_proto->set_renderer_failed_launch_count(count); 94 stability_proto->set_renderer_failed_launch_count(count);
95 local_state_->SetInteger(prefs::kStabilityRendererFailedLaunchCount, 0); 95 local_state_->SetInteger(prefs::kStabilityRendererFailedLaunchCount, 0);
96 } 96 }
97 97
98 count = local_state_->GetInteger(prefs::kStabilityRendererLaunchCount);
99 if (count) {
100 stability_proto->set_renderer_launch_count(count);
101 local_state_->SetInteger(prefs::kStabilityRendererLaunchCount, 0);
102 }
103
98 count = 104 count =
99 local_state_->GetInteger(prefs::kStabilityExtensionRendererCrashCount); 105 local_state_->GetInteger(prefs::kStabilityExtensionRendererCrashCount);
100 if (count) { 106 if (count) {
101 stability_proto->set_extension_renderer_crash_count(count); 107 stability_proto->set_extension_renderer_crash_count(count);
102 local_state_->SetInteger(prefs::kStabilityExtensionRendererCrashCount, 0); 108 local_state_->SetInteger(prefs::kStabilityExtensionRendererCrashCount, 0);
103 } 109 }
104 110
105 count = local_state_->GetInteger( 111 count = local_state_->GetInteger(
106 prefs::kStabilityExtensionRendererFailedLaunchCount); 112 prefs::kStabilityExtensionRendererFailedLaunchCount);
107 if (count) { 113 if (count) {
108 stability_proto->set_extension_renderer_failed_launch_count(count); 114 stability_proto->set_extension_renderer_failed_launch_count(count);
109 local_state_->SetInteger( 115 local_state_->SetInteger(
110 prefs::kStabilityExtensionRendererFailedLaunchCount, 0); 116 prefs::kStabilityExtensionRendererFailedLaunchCount, 0);
111 } 117 }
112 118
113 count = local_state_->GetInteger(prefs::kStabilityRendererHangCount); 119 count = local_state_->GetInteger(prefs::kStabilityRendererHangCount);
114 if (count) { 120 if (count) {
115 stability_proto->set_renderer_hang_count(count); 121 stability_proto->set_renderer_hang_count(count);
116 local_state_->SetInteger(prefs::kStabilityRendererHangCount, 0); 122 local_state_->SetInteger(prefs::kStabilityRendererHangCount, 0);
117 } 123 }
124
125 count = local_state_->GetInteger(prefs::kStabilityRendererLaunchCount);
126 if (count) {
127 stability_proto->set_renderer_launch_count(count);
128 local_state_->SetInteger(prefs::kStabilityRendererLaunchCount, 0);
129 }
118 } 130 }
119 131
120 void StabilityMetricsHelper::ClearSavedStabilityMetrics() { 132 void StabilityMetricsHelper::ClearSavedStabilityMetrics() {
121 // Clear all the prefs used in this class in UMA reports (which doesn't 133 // Clear all the prefs used in this class in UMA reports (which doesn't
122 // include |kUninstallMetricsPageLoadCount| as it's not sent up by UMA). 134 // include |kUninstallMetricsPageLoadCount| as it's not sent up by UMA).
123 local_state_->SetInteger(prefs::kStabilityChildProcessCrashCount, 0); 135 local_state_->SetInteger(prefs::kStabilityChildProcessCrashCount, 0);
124 local_state_->SetInteger(prefs::kStabilityExtensionRendererCrashCount, 0); 136 local_state_->SetInteger(prefs::kStabilityExtensionRendererCrashCount, 0);
125 local_state_->SetInteger(prefs::kStabilityExtensionRendererFailedLaunchCount, 137 local_state_->SetInteger(prefs::kStabilityExtensionRendererFailedLaunchCount,
126 0); 138 0);
139 local_state_->SetInteger(prefs::kStabilityExtensionRendererLaunchCount, 0);
127 local_state_->SetInteger(prefs::kStabilityPageLoadCount, 0); 140 local_state_->SetInteger(prefs::kStabilityPageLoadCount, 0);
128 local_state_->SetInteger(prefs::kStabilityRendererCrashCount, 0); 141 local_state_->SetInteger(prefs::kStabilityRendererCrashCount, 0);
129 local_state_->SetInteger(prefs::kStabilityRendererFailedLaunchCount, 0); 142 local_state_->SetInteger(prefs::kStabilityRendererFailedLaunchCount, 0);
130 local_state_->SetInteger(prefs::kStabilityRendererHangCount, 0); 143 local_state_->SetInteger(prefs::kStabilityRendererHangCount, 0);
144 local_state_->SetInteger(prefs::kStabilityRendererLaunchCount, 0);
131 } 145 }
132 146
133 // static 147 // static
134 void StabilityMetricsHelper::RegisterPrefs(PrefRegistrySimple* registry) { 148 void StabilityMetricsHelper::RegisterPrefs(PrefRegistrySimple* registry) {
135 registry->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0); 149 registry->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0);
136 registry->RegisterIntegerPref(prefs::kStabilityExtensionRendererCrashCount, 150 registry->RegisterIntegerPref(prefs::kStabilityExtensionRendererCrashCount,
137 0); 151 0);
138 registry->RegisterIntegerPref( 152 registry->RegisterIntegerPref(
139 prefs::kStabilityExtensionRendererFailedLaunchCount, 0); 153 prefs::kStabilityExtensionRendererFailedLaunchCount, 0);
154 registry->RegisterIntegerPref(prefs::kStabilityExtensionRendererLaunchCount,
155 0);
140 registry->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); 156 registry->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0);
141 registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); 157 registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
142 registry->RegisterIntegerPref(prefs::kStabilityRendererFailedLaunchCount, 0); 158 registry->RegisterIntegerPref(prefs::kStabilityRendererFailedLaunchCount, 0);
143 registry->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0); 159 registry->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0);
160 registry->RegisterIntegerPref(prefs::kStabilityRendererLaunchCount, 0);
144 161
145 registry->RegisterInt64Pref(prefs::kUninstallMetricsPageLoadCount, 0); 162 registry->RegisterInt64Pref(prefs::kUninstallMetricsPageLoadCount, 0);
146 } 163 }
147 164
148 void StabilityMetricsHelper::BrowserChildProcessCrashed() { 165 void StabilityMetricsHelper::BrowserChildProcessCrashed() {
149 IncrementPrefValue(prefs::kStabilityChildProcessCrashCount); 166 IncrementPrefValue(prefs::kStabilityChildProcessCrashCount);
150 } 167 }
151 168
152 void StabilityMetricsHelper::LogLoadStarted() { 169 void StabilityMetricsHelper::LogLoadStarted() {
153 base::RecordAction(base::UserMetricsAction("PageLoad")); 170 base::RecordAction(base::UserMetricsAction("PageLoad"));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 histogram_type, RENDERER_TYPE_COUNT); 216 histogram_type, RENDERER_TYPE_COUNT);
200 UMA_HISTOGRAM_SPARSE_SLOWLY( 217 UMA_HISTOGRAM_SPARSE_SLOWLY(
201 "BrowserRenderProcessHost.ChildLaunchFailureCodes", exit_code); 218 "BrowserRenderProcessHost.ChildLaunchFailureCodes", exit_code);
202 if (was_extension_process) 219 if (was_extension_process)
203 IncrementPrefValue(prefs::kStabilityExtensionRendererFailedLaunchCount); 220 IncrementPrefValue(prefs::kStabilityExtensionRendererFailedLaunchCount);
204 else 221 else
205 IncrementPrefValue(prefs::kStabilityRendererFailedLaunchCount); 222 IncrementPrefValue(prefs::kStabilityRendererFailedLaunchCount);
206 } 223 }
207 } 224 }
208 225
226 void StabilityMetricsHelper::LogRendererLaunched(bool was_extension_process) {
227 if (was_extension_process)
228 IncrementPrefValue(prefs::kStabilityExtensionRendererLaunchCount);
229 else
230 IncrementPrefValue(prefs::kStabilityRendererLaunchCount);
231 }
232
209 void StabilityMetricsHelper::IncrementPrefValue(const char* path) { 233 void StabilityMetricsHelper::IncrementPrefValue(const char* path) {
210 int value = local_state_->GetInteger(path); 234 int value = local_state_->GetInteger(path);
211 local_state_->SetInteger(path, value + 1); 235 local_state_->SetInteger(path, value + 1);
212 } 236 }
213 237
214 void StabilityMetricsHelper::IncrementLongPrefsValue(const char* path) { 238 void StabilityMetricsHelper::IncrementLongPrefsValue(const char* path) {
215 int64_t value = local_state_->GetInt64(path); 239 int64_t value = local_state_->GetInt64(path);
216 local_state_->SetInt64(path, value + 1); 240 local_state_->SetInt64(path, value + 1);
217 } 241 }
218 242
219 void StabilityMetricsHelper::LogRendererHang() { 243 void StabilityMetricsHelper::LogRendererHang() {
220 IncrementPrefValue(prefs::kStabilityRendererHangCount); 244 IncrementPrefValue(prefs::kStabilityRendererHangCount);
221 } 245 }
222 246
223 } // namespace metrics 247 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/stability_metrics_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698