| OLD | NEW |
| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Since |abs(STATUS_GUARD_PAGE_VIOLATION) == MAX_INT| it causes problems in | 46 // Since |abs(STATUS_GUARD_PAGE_VIOLATION) == MAX_INT| it causes problems in |
| 47 // histograms.cc. Solve this by remapping it to a smaller value, which | 47 // histograms.cc. Solve this by remapping it to a smaller value, which |
| 48 // hopefully doesn't conflict with other codes. | 48 // hopefully doesn't conflict with other codes. |
| 49 if (static_cast<DWORD>(exit_code) == STATUS_GUARD_PAGE_VIOLATION) | 49 if (static_cast<DWORD>(exit_code) == STATUS_GUARD_PAGE_VIOLATION) |
| 50 return 0x1FCF7EC3; // Randomly picked number. | 50 return 0x1FCF7EC3; // Randomly picked number. |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 return std::abs(exit_code); | 53 return std::abs(exit_code); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void RecordChildKills(int histogram_type) { | 56 void RecordChildKills(RendererType histogram_type) { |
| 57 UMA_HISTOGRAM_ENUMERATION("BrowserRenderProcessHost.ChildKills", | 57 UMA_HISTOGRAM_ENUMERATION("BrowserRenderProcessHost.ChildKills", |
| 58 histogram_type, RENDERER_TYPE_COUNT); | 58 histogram_type, RENDERER_TYPE_COUNT); |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 StabilityMetricsHelper::StabilityMetricsHelper(PrefService* local_state) | 63 StabilityMetricsHelper::StabilityMetricsHelper(PrefService* local_state) |
| 64 : local_state_(local_state) { | 64 : local_state_(local_state) { |
| 65 DCHECK(local_state_); | 65 DCHECK(local_state_); |
| 66 } | 66 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 LOCAL_HISTOGRAM_BOOLEAN("Chrome.UmaPageloadCounter", true); | 174 LOCAL_HISTOGRAM_BOOLEAN("Chrome.UmaPageloadCounter", true); |
| 175 IncrementPrefValue(prefs::kStabilityPageLoadCount); | 175 IncrementPrefValue(prefs::kStabilityPageLoadCount); |
| 176 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); | 176 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); |
| 177 // We need to save the prefs, as page load count is a critical stat, and it | 177 // We need to save the prefs, as page load count is a critical stat, and it |
| 178 // might be lost due to a crash :-(. | 178 // might be lost due to a crash :-(. |
| 179 } | 179 } |
| 180 | 180 |
| 181 void StabilityMetricsHelper::LogRendererCrash(bool was_extension_process, | 181 void StabilityMetricsHelper::LogRendererCrash(bool was_extension_process, |
| 182 base::TerminationStatus status, | 182 base::TerminationStatus status, |
| 183 int exit_code) { | 183 int exit_code) { |
| 184 int histogram_type = | 184 RendererType histogram_type = |
| 185 was_extension_process ? RENDERER_TYPE_EXTENSION : RENDERER_TYPE_RENDERER; | 185 was_extension_process ? RENDERER_TYPE_EXTENSION : RENDERER_TYPE_RENDERER; |
| 186 | 186 |
| 187 switch (status) { | 187 switch (status) { |
| 188 case base::TERMINATION_STATUS_NORMAL_TERMINATION: | 188 case base::TERMINATION_STATUS_NORMAL_TERMINATION: |
| 189 break; | 189 break; |
| 190 case base::TERMINATION_STATUS_PROCESS_CRASHED: | 190 case base::TERMINATION_STATUS_PROCESS_CRASHED: |
| 191 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: | 191 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: |
| 192 case base::TERMINATION_STATUS_OOM: | 192 case base::TERMINATION_STATUS_OOM: |
| 193 if (was_extension_process) { | 193 if (was_extension_process) { |
| 194 IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount); | 194 IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 void StabilityMetricsHelper::IncrementLongPrefsValue(const char* path) { | 258 void StabilityMetricsHelper::IncrementLongPrefsValue(const char* path) { |
| 259 int64_t value = local_state_->GetInt64(path); | 259 int64_t value = local_state_->GetInt64(path); |
| 260 local_state_->SetInt64(path, value + 1); | 260 local_state_->SetInt64(path, value + 1); |
| 261 } | 261 } |
| 262 | 262 |
| 263 void StabilityMetricsHelper::LogRendererHang() { | 263 void StabilityMetricsHelper::LogRendererHang() { |
| 264 IncrementPrefValue(prefs::kStabilityRendererHangCount); | 264 IncrementPrefValue(prefs::kStabilityRendererHangCount); |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace metrics | 267 } // namespace metrics |
| OLD | NEW |