Bug 1304790 - Add a telemetry probe that measures how long it takes for a content process to start up and communicate back to the parent, r?mconley data-r?francois draft
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 09 Dec 2016 08:52:28 -1000
changeset 448279 18157db52970ebd5a2950627dd19e21803dbc5dc
parent 448211 28d3c72eaecdc719fa4a01d5bb2d345b216070a9
child 539248 912e1a8d703239b4a0e0a67da3313a6afd2703ca
push id38298
push userbsmedberg@mozilla.com
push dateFri, 09 Dec 2016 18:53:25 +0000
reviewersmconley
bugs1304790
milestone53.0a1
Bug 1304790 - Add a telemetry probe that measures how long it takes for a content process to start up and communicate back to the parent, r?mconley data-r?francois MozReview-Commit-ID: 5OaeqZXL6zS
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
toolkit/components/telemetry/Histograms.json
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1786,16 +1786,17 @@ ContentParent::LaunchSubprocess(ProcessP
   SetReplyTimeoutMs(Preferences::GetInt("dom.ipc.cpow.timeout", 0));
 
   return true;
 }
 
 ContentParent::ContentParent(ContentParent* aOpener,
                              const nsAString& aRemoteType)
   : nsIContentParent()
+  , mLaunchTS(TimeStamp::Now())
   , mOpener(aOpener)
   , mRemoteType(aRemoteType)
   , mIsForBrowser(!mRemoteType.IsEmpty())
 {
   InitializeMembers();  // Perform common initialization.
 
   // Insert ourselves into the global linked list of ContentParent objects.
   if (!sContentParents) {
@@ -2500,16 +2501,20 @@ ContentParent::RecvGetXPCOMProcessAttrib
                                              InfallibleTArray<nsString>* dictionaries,
                                              ClipboardCapabilities* clipboardCaps,
                                              DomainPolicyClone* domainPolicy,
                                              StructuredCloneData* aInitialData,
                                              InfallibleTArray<FontFamilyListEntry>* fontFamilies,
                                              OptionalURIParams* aUserContentCSSURL,
                                              nsTArray<LookAndFeelInt>* aLookAndFeelIntCache)
 {
+  Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS,
+                        static_cast<uint32_t>((TimeStamp::Now() - mLaunchTS)
+                                              .ToMilliseconds()));
+
   nsCOMPtr<nsIIOService> io(do_GetIOService());
   MOZ_ASSERT(io, "No IO service?");
   DebugOnly<nsresult> rv = io->GetOffline(aIsOffline);
   MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting offline?");
 
   rv = io->GetConnectivity(aIsConnected);
   MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting connectivity?");
 
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -12,16 +12,17 @@
 #include "mozilla/gfx/gfxVarReceiver.h"
 #include "mozilla/gfx/GPUProcessListener.h"
 #include "mozilla/ipc/GeckoChildProcessHost.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/FileUtils.h"
 #include "mozilla/HalTypes.h"
 #include "mozilla/LinkedList.h"
 #include "mozilla/StaticPtr.h"
+#include "mozilla/TimeStamp.h"
 #include "mozilla/UniquePtr.h"
 
 #include "nsDataHashtable.h"
 #include "nsFrameMessageManager.h"
 #include "nsHashKeys.h"
 #include "nsIObserver.h"
 #include "nsIThreadInternal.h"
 #include "nsIDOMGeoPositionCallback.h"
@@ -1091,16 +1092,17 @@ public:
 
 private:
 
   // If you add strong pointers to cycle collected objects here, be sure to
   // release these objects in ShutDownProcess.  See the comment there for more
   // details.
 
   GeckoChildProcessHost* mSubprocess;
+  const TimeStamp mLaunchTS; // used to calculate time to start content process
   ContentParent* mOpener;
 
   nsString mRemoteType;
 
   ContentParentId mChildID;
   int32_t mGeolocationWatchID;
 
   nsCString mKillHardAnnotation;
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -181,16 +181,26 @@
   },
   "COMPOSITE_FRAME_ROUNDTRIP_TIME" : {
     "expires_in_version": "never",
     "description": "Time from vsync to finishing a composite in milliseconds.",
     "kind": "exponential",
     "high": 1000,
     "n_buckets": 50
   },
+  "CONTENT_PROCESS_LAUNCH_TIME_MS" : {
+    "alert_emails": ["bsmedberg@mozilla.com", "mconley@mozilla.com"],
+    "expires_in_version": "57",
+    "bug_numbers": [1304790],
+    "kind": "exponential",
+    "high": 64000,
+    "n_buckets": 100,
+    "releaseChannelCollection": "opt-out",
+    "description": "Content process launch time until the GetXPCOMProcessAttributes message is received, from  in milliseconds"
+  },
   "CONTENT_RESPONSE_DURATION" : {
     "alert_emails": ["kgupta@mozilla.com"],
     "bug_numbers": [1261373],
     "expires_in_version": "55",
     "description": "Main thread response times for APZ notifications about input events (ms)",
     "kind" : "exponential",
     "high": 60000,
     "n_buckets": 50