Android: Unify android gpu crash counts
Use stability.gpu_crash_count in the system_profile proto to track gpu
crash metrics rather than a variety of changing gpu histograms.
This new proto value is only used on Android starting in M71 and tracks
the same value as the histogram:
"Stability.Android.ProcessedCrashCounts.All GPU process crashes"
Thus this unifies our gpu metrics across stability proto, UMA histogram,
and crash reports, since these all count the number of crashes with a
valid crash dump (note that crash reports only include the number that
are successfully processed and uploaded, so should be slightly reduced).
Bug: 839017
Change-Id: If836b4fc8c8390ce008b7089a773af0b26ea6c10
Reviewed-on: https://chromium-review.googlesource.com/1228546
Commit-Queue: Ramin Halavati <[email protected]>
Reviewed-by: Ramin Halavati <[email protected]>
Reviewed-by: Alexei Svitkine <[email protected]>
Cr-Commit-Position: refs/heads/master@{#591947}
diff --git a/components/metrics/metrics_pref_names.cc b/components/metrics/metrics_pref_names.cc
index 2bf002fe..a7a79c8 100644
--- a/components/metrics/metrics_pref_names.cc
+++ b/components/metrics/metrics_pref_names.cc
@@ -147,6 +147,11 @@
const char kStabilityGmsCoreVersion[] =
"user_experience_metrics.stability.gms_core_version";
+// Number of times a gpu process crashed since the last report. Currently only
+// recorded on Android.
+const char kStabilityGpuCrashCount[] =
+ "user_experience_metrics.stability.gpu_crash_count";
+
// Number of times the session end did not complete.
const char kStabilityIncompleteSessionEndCount[] =
"user_experience_metrics.stability.incomplete_session_end_count";
diff --git a/components/metrics/metrics_pref_names.h b/components/metrics/metrics_pref_names.h
index 468dad8..9901968 100644
--- a/components/metrics/metrics_pref_names.h
+++ b/components/metrics/metrics_pref_names.h
@@ -49,6 +49,7 @@
extern const char kStabilityExtensionRendererFailedLaunchCount[];
extern const char kStabilityExtensionRendererLaunchCount[];
extern const char kStabilityGmsCoreVersion[];
+extern const char kStabilityGpuCrashCount[];
extern const char kStabilityIncompleteSessionEndCount[];
extern const char kStabilityLaunchCount[];
extern const char kStabilityPageLoadCount[];
diff --git a/components/metrics/stability_metrics_helper.cc b/components/metrics/stability_metrics_helper.cc
index 517fc71..97f962e 100644
--- a/components/metrics/stability_metrics_helper.cc
+++ b/components/metrics/stability_metrics_helper.cc
@@ -105,6 +105,12 @@
local_state_->SetInteger(prefs::kStabilityChildProcessCrashCount, 0);
}
+ count = local_state_->GetInteger(prefs::kStabilityGpuCrashCount);
+ if (count) {
+ stability_proto->set_gpu_crash_count(count);
+ local_state_->SetInteger(prefs::kStabilityGpuCrashCount, 0);
+ }
+
count = local_state_->GetInteger(prefs::kStabilityRendererCrashCount);
if (count) {
stability_proto->set_renderer_crash_count(count);
@@ -160,6 +166,7 @@
local_state_->SetInteger(prefs::kStabilityExtensionRendererFailedLaunchCount,
0);
local_state_->SetInteger(prefs::kStabilityExtensionRendererLaunchCount, 0);
+ local_state_->SetInteger(prefs::kStabilityGpuCrashCount, 0);
local_state_->SetInteger(prefs::kStabilityPageLoadCount, 0);
local_state_->SetInteger(prefs::kStabilityRendererCrashCount, 0);
local_state_->SetInteger(prefs::kStabilityRendererFailedLaunchCount, 0);
@@ -176,6 +183,7 @@
prefs::kStabilityExtensionRendererFailedLaunchCount, 0);
registry->RegisterIntegerPref(prefs::kStabilityExtensionRendererLaunchCount,
0);
+ registry->RegisterIntegerPref(prefs::kStabilityGpuCrashCount, 0);
registry->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0);
registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
registry->RegisterIntegerPref(prefs::kStabilityRendererFailedLaunchCount, 0);
@@ -189,6 +197,10 @@
IncrementPrefValue(prefs::kStabilityRendererCrashCount);
}
+void StabilityMetricsHelper::IncreaseGpuCrashCount() {
+ IncrementPrefValue(prefs::kStabilityGpuCrashCount);
+}
+
void StabilityMetricsHelper::BrowserUtilityProcessLaunched(
const std::string& metrics_name) {
uint32_t hash = variations::HashName(metrics_name);
diff --git a/components/metrics/stability_metrics_helper.h b/components/metrics/stability_metrics_helper.h
index 5a22882a..e99f998c 100644
--- a/components/metrics/stability_metrics_helper.h
+++ b/components/metrics/stability_metrics_helper.h
@@ -61,6 +61,12 @@
// Increments the RendererCrash pref.
void IncreaseRendererCrashCount();
+ // Increments the GpuCrash pref.
+ // Note: This is currently only used on Android. If you want to call this on
+ // another platform, server-side processing code needs to be updated for that
+ // platform to use the new data. Server-side currently assumes Android-only.
+ void IncreaseGpuCrashCount();
+
private:
// Increments an Integer pref value specified by |path|.
void IncrementPrefValue(const char* path);