From 126afc3ab43b8a713503f8878a42b2b2fb0c4c06 Mon Sep 17 00:00:00 2001 From: Gerald Squelart Date: Fri, 17 Jul 2020 11:22:23 +0000 Subject: [PATCH] Bug 1653181 - Profiler feature 'audiocallbacktracing' controls Start/StopAudioCallbackTracing(), off by default - r=canaltinova Differential Revision: https://phabricator.services.mozilla.com/D83749 --- devtools/client/performance-new/utils.js | 5 +++++ mozglue/baseprofiler/public/BaseProfiler.h | 5 ++++- toolkit/components/extensions/schemas/geckoProfiler.json | 3 ++- tools/profiler/core/platform.cpp | 8 ++++++-- tools/profiler/public/GeckoProfiler.h | 5 ++++- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/devtools/client/performance-new/utils.js b/devtools/client/performance-new/utils.js index 4636a4bcf5bf..3a971d9f2ef3 100644 --- a/devtools/client/performance-new/utils.js +++ b/devtools/client/performance-new/utils.js @@ -406,6 +406,11 @@ const featureDescriptions = [ value: "nativeallocations", title: "Track native allocations", }, + { + name: "Audio Callback Tracing", + value: "audiocallbacktracing", + title: "Trace real-time audio callbacks.", + }, ]; module.exports = { diff --git a/mozglue/baseprofiler/public/BaseProfiler.h b/mozglue/baseprofiler/public/BaseProfiler.h index 89a0e643dc9f..6aa38f072bf6 100644 --- a/mozglue/baseprofiler/public/BaseProfiler.h +++ b/mozglue/baseprofiler/public/BaseProfiler.h @@ -156,7 +156,10 @@ class SpliceableJSONWriter; "allocations, biasing towards collecting larger allocations") \ \ MACRO(17, "ipcmessages", IPCMessages, \ - "Have the IPC layer track cross-process messages") + "Have the IPC layer track cross-process messages") \ + \ + MACRO(18, "audiocallbacktracing", AudioCallbackTracing, \ + "Audio callback tracing") struct ProfilerFeature { # define DECLARE(n_, str_, Name_, desc_) \ diff --git a/toolkit/components/extensions/schemas/geckoProfiler.json b/toolkit/components/extensions/schemas/geckoProfiler.json index e30303f65835..397a52861ebd 100644 --- a/toolkit/components/extensions/schemas/geckoProfiler.json +++ b/toolkit/components/extensions/schemas/geckoProfiler.json @@ -41,7 +41,8 @@ "ipcmessages", "fileio", "fileioall", - "noiostacks" + "noiostacks", + "audiocallbacktracing" ] }, { diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index e0a7adfb74be..556c33fbf2d1 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -4543,7 +4543,9 @@ static void locked_profiler_start(PSLockRef aLock, PowerOfTwo32 aCapacity, } #endif - StartAudioCallbackTracing(); + if (ProfilerFeature::HasAudioCallbackTracing(aFeatures)) { + StartAudioCallbackTracing(); + } // At the very end, set up RacyFeatures. RacyFeatures::SetActive(ActivePS::Features(aLock)); @@ -4652,7 +4654,9 @@ void profiler_ensure_started(PowerOfTwo32 aCapacity, double aInterval, // At the very start, clear RacyFeatures. RacyFeatures::SetInactive(); - StopAudioCallbackTracing(); + if (ActivePS::FeatureAudioCallbackTracing(aLock)) { + StopAudioCallbackTracing(); + } #if defined(GP_OS_android) if (ActivePS::FeatureJava(aLock)) { diff --git a/tools/profiler/public/GeckoProfiler.h b/tools/profiler/public/GeckoProfiler.h index 8c196f6d6317..66b29440ba78 100644 --- a/tools/profiler/public/GeckoProfiler.h +++ b/tools/profiler/public/GeckoProfiler.h @@ -194,7 +194,10 @@ class Vector; "allocations, biasing towards collecting larger allocations") \ \ MACRO(17, "ipcmessages", IPCMessages, \ - "Have the IPC layer track cross-process messages") + "Have the IPC layer track cross-process messages") \ + \ + MACRO(18, "audiocallbacktracing", AudioCallbackTracing, \ + "Audio callback tracing") struct ProfilerFeature { # define DECLARE(n_, str_, Name_, desc_) \