From 532849a1b03fe1bde1fae36d130b0b126e90d4ea Mon Sep 17 00:00:00 2001 From: Paul Bone Date: Sat, 18 May 2024 02:05:50 +0000 Subject: [PATCH] Bug 1897060 - Gather process lifetime telemetry r=ipc-reviewers,mccr8 Differential Revision: https://phabricator.services.mozilla.com/D210751 --- dom/ipc/ContentParent.cpp | 8 ++++++++ toolkit/components/telemetry/Histograms.json | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 583f1b6192af..be847ee3112f 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2039,6 +2039,14 @@ void ContentParent::ActorDestroy(ActorDestroyReason why) { MOZ_FUZZING_IPC_DROP_PEER("ContentParent::ActorDestroy"); #endif + // Gather process lifetime telemetry. + if (StringBeginsWith(mRemoteType, WEB_REMOTE_TYPE) || + mRemoteType == FILE_REMOTE_TYPE || mRemoteType == EXTENSION_REMOTE_TYPE) { + TimeDuration runtime = TimeStamp::Now() - mActivateTS; + Telemetry::Accumulate(Telemetry::PROCESS_LIFETIME, + uint64_t(runtime.ToSeconds())); + } + if (mSendShutdownTimer) { mSendShutdownTimer->Cancel(); mSendShutdownTimer = nullptr; diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 0cc46edde75c..90d3b364faef 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -1790,6 +1790,19 @@ "description": "Number of PHC slots allocated-then-freed", "releaseChannelCollection": "opt-out" }, + "PROCESS_LIFETIME": { + "record_in_processes": ["main"], + "products": ["firefox"], + "alert_emails": ["pbone@mozilla.com"], + "bug_numbers": [1897060], + "expires_in_version": "135", + "kind": "exponential", + "low": 15, + "high": 86400, + "n_buckets": 24, + "description": "Average lifetime of a content process in seconds", + "releaseChannelCollection": "opt-out" + }, "FONTLIST_INITOTHERFAMILYNAMES": { "record_in_processes": ["main", "content"],