diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 97903269c15404be56366663e00cd31e8045509f..616e270303bf2112a04658019613f8e31215fa31 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -1295,6 +1295,18 @@ "n_buckets": 100, "description": "Maximum-sized block of contiguous virtual memory (KB)" }, + "MEMORY_COLLECTION_TIME": { + "record_in_processes": ["all"], + "products": ["firefox"], + "alert_emails": ["memshrink-telemetry-alerts@mozilla.com"], + "expires_in_version": "never", + "kind": "exponential", + "low": 1, + "high": 60000, + "n_buckets": 32, + "bug_numbers": [1786864], + "description": "Time spent gathering memory telemetry in milliseconds" + }, "MEMORY_JS_COMPARTMENTS_SYSTEM": { "record_in_processes": ["main", "content"], "products": ["firefox", "fennec", "thunderbird"], diff --git a/xpcom/base/MemoryTelemetry.cpp b/xpcom/base/MemoryTelemetry.cpp index 75b47d4d887b24d2d01b279d4e66602a38abb920..9fe731543e1de60ea96b9a94fcb5cf69cc135ed6 100644 --- a/xpcom/base/MemoryTelemetry.cpp +++ b/xpcom/base/MemoryTelemetry.cpp @@ -272,6 +272,7 @@ nsresult MemoryTelemetry::GatherReports( // asynchronously, on a background thread. RefPtr<Runnable> runnable = NS_NewRunnableFunction( "MemoryTelemetry::GatherReports", [mgr, completionRunnable]() mutable { + Telemetry::AutoTimer<Telemetry::MEMORY_COLLECTION_TIME> autoTimer; RECORD(MEMORY_VSIZE, Vsize, UNITS_BYTES); #if !defined(HAVE_64BIT_BUILD) || !defined(XP_WIN) RECORD(MEMORY_VSIZE_MAX_CONTIGUOUS, VsizeMaxContiguous, UNITS_BYTES);