Bug 1388274 - Adjust WebVR telemetry histogram's high bound for user time spent; r?francois, kip draft
authorDaosheng Mu <daoshengmu@gmail.com>
Tue, 08 Aug 2017 18:23:43 +0800
changeset 642981 7e3f7d01f43b45004b898a5bd4b4e911898390fd
parent 642204 65507616792c990b1230888612dd7ffc13ed32b4
child 725163 4500717d77ba11fbe73c39afea7757e779ed1a4c
push id72941
push userbmo:dmu@mozilla.com
push dateWed, 09 Aug 2017 03:39:57 +0000
reviewersfrancois, kip
bugs1388274
milestone57.0a1
Bug 1388274 - Adjust WebVR telemetry histogram's high bound for user time spent; r?francois, kip MozReview-Commit-ID: JcQZTgVmxr3
dom/vr/VREventObserver.cpp
gfx/vr/gfxVROculus.cpp
gfx/vr/gfxVROpenVR.cpp
toolkit/components/telemetry/Histograms.json
--- a/dom/vr/VREventObserver.cpp
+++ b/dom/vr/VREventObserver.cpp
@@ -45,19 +45,18 @@ VREventObserver::DisconnectFromOwner()
 {
   // In the event that nsGlobalWindow is deallocated, VREventObserver may
   // still be AddRef'ed elsewhere.  Ensure that we don't UAF by
   // dereferencing mWindow.
   if (mWindow && mIs2DView) {
     // The WebVR content is closed, and we will collect the telemetry info
     // for the users who view it in 2D view only.
     Telemetry::Accumulate(Telemetry::WEBVR_USERS_VIEW_IN, 0);
-    Telemetry::Accumulate(Telemetry::WEBVR_TIME_SPEND_FOR_VIEWING_IN_2D,
-                          static_cast<uint32_t>((TimeStamp::Now() - mSpendTimeIn2DView)
-                          .ToMilliseconds()));
+    Telemetry::AccumulateTimeDelta(Telemetry::WEBVR_TIME_SPENT_VIEWING_IN_2D,
+                                   mSpendTimeIn2DView);
   }
   mWindow = nullptr;
 
   // Unregister from VRManagerChild
   if (VRManagerChild::IsCreated()) {
     VRManagerChild* vmc = VRManagerChild::Get();
     vmc->RemoveListener(this);
   }
--- a/gfx/vr/gfxVROculus.cpp
+++ b/gfx/vr/gfxVROculus.cpp
@@ -239,19 +239,18 @@ VROculusSession::StartPresentation(const
 
 void
 VROculusSession::StopPresentation()
 {
   if (mPresenting) {
     mLastPresentationEnd = TimeStamp::Now();
     mPresenting = false;
     Telemetry::Accumulate(Telemetry::WEBVR_USERS_VIEW_IN, 1);
-    Telemetry::Accumulate(Telemetry::WEBVR_TIME_SPEND_FOR_VIEWING_IN_OCULUS,
-                          static_cast<uint32_t>((TimeStamp::Now() - mPresentationStart)
-                          .ToMilliseconds()));
+    Telemetry::AccumulateTimeDelta(Telemetry::WEBVR_TIME_SPENT_VIEWING_IN_OCULUS,
+                                   mPresentationStart);
     Refresh();
   }
 }
 
 VROculusSession::~VROculusSession()
 {
   Uninitialize(true);
 }
--- a/gfx/vr/gfxVROpenVR.cpp
+++ b/gfx/vr/gfxVROpenVR.cpp
@@ -277,19 +277,18 @@ VRDisplayOpenVR::StopPresentation()
   if (!mIsPresenting) {
     return;
   }
 
   mVRCompositor->ClearLastSubmittedFrame();
 
   mIsPresenting = false;
   Telemetry::Accumulate(Telemetry::WEBVR_USERS_VIEW_IN, 2);
-  Telemetry::Accumulate(Telemetry::WEBVR_TIME_SPEND_FOR_VIEWING_IN_OPENVR,
-                        static_cast<uint32_t>((TimeStamp::Now() - mPresentationStart)
-                        .ToMilliseconds()));
+  Telemetry::AccumulateTimeDelta(Telemetry::WEBVR_TIME_SPENT_VIEWING_IN_OPENVR,
+                                 mPresentationStart);
 }
 
 bool
 VRDisplayOpenVR::SubmitFrame(void* aTextureHandle,
                              ::vr::ETextureType aTextureType,
                              const IntSize& aSize,
                              const gfx::Rect& aLeftEyeRect,
                              const gfx::Rect& aRightEyeRect)
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -13643,50 +13643,50 @@
   "WEBVR_USERS_VIEW_IN": {
     "record_in_processes": ["main", "gpu", "content"],
     "alert_emails": ["dmu@mozilla.com"],
     "bug_numbers": [1306156],
     "expires_in_version": "never",
     "kind": "enumerated",
     "n_values": 3,
     "releaseChannelCollection": "opt-out",
-    "description": "The amount of users who view VR content in: 2D=0, Oculus=1, OpenVR=2."
-  },
-  "WEBVR_TIME_SPEND_FOR_VIEWING_IN_2D": {
+    "description": "The amount of sessions who view VR content in: 2D=0, Oculus=1, OpenVR=2."
+  },
+  "WEBVR_TIME_SPENT_VIEWING_IN_2D": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["dmu@mozilla.com"],
     "bug_numbers": [1306156],
     "expires_in_version": "never",
     "kind": "exponential",
-    "high": 50000,
-    "n_buckets": 100,
-    "releaseChannelCollection": "opt-out",
-    "description": "The amount of time spend(ms) for users who view VR content in 2D."
-  },
-  "WEBVR_TIME_SPEND_FOR_VIEWING_IN_OCULUS": {
+    "high": 1200000,
+    "n_buckets": 100,
+    "releaseChannelCollection": "opt-out",
+    "description": "The amount of time spent(ms) of a session for viewing VR content in 2D."
+  },
+  "WEBVR_TIME_SPENT_VIEWING_IN_OCULUS": {
     "record_in_processes": ["main", "gpu"],
     "alert_emails": ["dmu@mozilla.com"],
     "bug_numbers": [1306156],
     "expires_in_version": "never",
     "kind": "exponential",
-    "high": 50000,
-    "n_buckets": 100,
-    "releaseChannelCollection": "opt-out",
-    "description": "The amount of time spend(ms) for users who view VR content in Oculus."
-  },
-  "WEBVR_TIME_SPEND_FOR_VIEWING_IN_OPENVR": {
+    "high": 1200000,
+    "n_buckets": 100,
+    "releaseChannelCollection": "opt-out",
+    "description": "The amount of time spent(ms) of a session for viewing content in Oculus."
+  },
+  "WEBVR_TIME_SPENT_VIEWING_IN_OPENVR": {
     "record_in_processes": ["main", "gpu"],
     "alert_emails": ["dmu@mozilla.com"],
     "bug_numbers": [1306156],
     "expires_in_version": "never",
     "kind": "exponential",
-    "high": 50000,
-    "n_buckets": 100,
-    "releaseChannelCollection": "opt-out",
-    "description": "The amount of time spend(ms) for users who view VR content in OpenVR."
+    "high": 1200000,
+    "n_buckets": 100,
+    "releaseChannelCollection": "opt-out",
+    "description": "The amount of time spent(ms) of a session for viewing content in OpenVR."
   },
   "URLCLASSIFIER_UI_EVENTS": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["seceng-telemetry@mozilla.com", "francois@mozilla.com"],
     "bug_numbers": [1375277],
     "expires_in_version": "never",
     "kind": "enumerated",
     "n_values": 64,