Bug 1338011 - Adds some telemetry probes - f=bsmedberg r=dvander draft
authorJay Harris <jharris@mozilla.com>
Sat, 15 Apr 2017 09:36:42 +1200
changeset 563123 124e0b1a6e5417ff5a9452acb61679af3573a295
parent 563122 cf46de367eacc5a9ccd9ca583d94d951041b5f9a
child 624401 43e03d55918be166ce2b5edb30e0b851b06af626
push id54217
push usergsquelart@mozilla.com
push dateSat, 15 Apr 2017 03:37:24 +0000
reviewersdvander
bugs1338011
milestone55.0a1
Bug 1338011 - Adds some telemetry probes - f=bsmedberg r=dvander MozReview-Commit-ID: BmwEjBiCBNo
gfx/ipc/GPUProcessManager.cpp
toolkit/components/telemetry/Histograms.json
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -46,16 +46,23 @@
 #include "mozilla/layers/UiCompositorControllerChild.h"
 #endif // defined(MOZ_WIDGET_ANDROID)
 
 namespace mozilla {
 namespace gfx {
 
 using namespace mozilla::layers;
 
+enum class FallbackType : uint32_t
+{
+  NONE = 0,
+  DECODINGDISABLED,
+  DISABLED,
+};
+
 static StaticAutoPtr<GPUProcessManager> sSingleton;
 
 GPUProcessManager*
 GPUProcessManager::Get()
 {
   return sSingleton;
 }
 
@@ -158,16 +165,19 @@ GPUProcessManager::DisableGPUProcess(con
     return;
   }
 
   gfxConfig::SetFailed(Feature::GPU_PROCESS, FeatureStatus::Failed, aMessage);
   gfxCriticalNote << aMessage;
 
   gfxPlatform::NotifyGPUProcessDisabled();
 
+  Telemetry::Accumulate(Telemetry::GPU_PROCESS_CRASH_FALLBACKS,
+                        uint32_t(FallbackType::DISABLED));
+
   DestroyProcess();
   ShutdownVsyncIOThread();
 }
 
 bool
 GPUProcessManager::EnsureGPUReady()
 {
   if (mProcess && !mProcess->IsConnected()) {
@@ -374,18 +384,24 @@ GPUProcessManager::OnProcessUnexpectedSh
 
   DestroyProcess();
 
   if (mNumProcessAttempts > uint32_t(gfxPrefs::GPUProcessMaxRestarts())) {
     char disableMessage[64];
     SprintfLiteral(disableMessage, "GPU process disabled after %d attempts",
                    mNumProcessAttempts);
     DisableGPUProcess(disableMessage);
-  } else if (mNumProcessAttempts > uint32_t(gfxPrefs::GPUProcessMaxRestartsWithDecoder())) {
+  } else if (mNumProcessAttempts > uint32_t(gfxPrefs::GPUProcessMaxRestartsWithDecoder()) &&
+             mDecodeVideoOnGpuProcess) {
     mDecodeVideoOnGpuProcess = false;
+    Telemetry::Accumulate(Telemetry::GPU_PROCESS_CRASH_FALLBACKS,
+                                     uint32_t(FallbackType::DECODINGDISABLED));
+  } else {
+    Telemetry::Accumulate(Telemetry::GPU_PROCESS_CRASH_FALLBACKS,
+                                     uint32_t(FallbackType::NONE));
   }
 
   HandleProcessLost();
 }
 
 void
 GPUProcessManager::HandleProcessLost()
 {
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -1147,16 +1147,25 @@
     "expires_in_version": "never",
     "bug_numbers": [1324095],
     "kind": "exponential",
     "high": 64000,
     "n_buckets": 100,
     "releaseChannelCollection": "opt-out",
     "description": "GPU process initialization (excluding XPCOM and fork time) time in milliseconds"
   },
+  "GPU_PROCESS_CRASH_FALLBACKS": {
+    "alert_emails": ["cpearce@mozilla.com", "gsquelart@mozilla.com"],
+    "expires_in_version": "60",
+    "bug_numbers": [1338011],
+    "kind": "enumerated",
+    "releaseChannelCollection": "opt-out",
+    "n_values":  10,
+    "description": "Count how often we use different fallbacks when the GPU process crashes: None=0, GPUProcessDecodingDisabled=1, GPUProcessDisabled=2"
+  },
   "JS_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT": {
     "alert_emails": ["jdemooij@mozilla.com"],
     "expires_in_version": "never",
     "kind": "enumerated",
     "n_values": 10,
     "description": "Use of SpiderMonkey's deprecated language extensions in web content: ForEach=0, DestructuringForIn=1 (obsolete), LegacyGenerator=2, ExpressionClosure=3, LetBlock=4 (obsolete), LetExpression=5 (obsolete), NoSuchMethod=6 (obsolete), FlagsArgument=7 (obsolete), RegExpSourceProp=8 (obsolete), RestoredRegExpStatics=9 (obsolete), BlockScopeFunRedecl=10"
   },
   "JS_DEPRECATED_LANGUAGE_EXTENSIONS_IN_ADDONS": {