Bug 1729815 - Remove unnecessary profiler feature "threads" - r=julienw,perftest-reviewers,AlexandruIonescu

This feature doesn't have any effect anymore.

Differential Revision: https://phabricator.services.mozilla.com/D133860
This commit is contained in:
Gerald Squelart 2021-12-16 23:46:18 +00:00
Родитель 422693242c
Коммит c40dcd12b5
18 изменённых файлов: 60 добавлений и 95 удалений

Просмотреть файл

@ -80,7 +80,6 @@ class ActorReadyGeckoProfilerInterface {
"stackwalk", "stackwalk",
"cpu", "cpu",
"responsiveness", "responsiveness",
"threads",
"leaf", "leaf",
], ],
threads: options.threads || ["GeckoMain", "Compositor"], threads: options.threads || ["GeckoMain", "Compositor"],

Просмотреть файл

@ -231,8 +231,7 @@ static uint32_t AvailableFeatures() {
// Default features common to all contexts (even if not available). // Default features common to all contexts (even if not available).
static constexpr uint32_t DefaultFeatures() { static constexpr uint32_t DefaultFeatures() {
return ProfilerFeature::Java | ProfilerFeature::JS | ProfilerFeature::Leaf | return ProfilerFeature::Java | ProfilerFeature::JS | ProfilerFeature::Leaf |
ProfilerFeature::StackWalk | ProfilerFeature::Threads | ProfilerFeature::StackWalk | ProfilerFeature::CPUUtilization;
ProfilerFeature::CPUUtilization;
} }
// Extra default features when MOZ_PROFILER_STARTUP is set (even if not // Extra default features when MOZ_PROFILER_STARTUP is set (even if not
@ -604,13 +603,6 @@ class ActivePS {
// Filter out any features unavailable in this platform/configuration. // Filter out any features unavailable in this platform/configuration.
aFeatures &= AvailableFeatures(); aFeatures &= AvailableFeatures();
// Always enable ProfilerFeature::Threads if we have a filter, because
// users sometimes ask to filter by a list of threads but forget to
// explicitly specify ProfilerFeature::Threads.
if (aFilterCount > 0) {
aFeatures |= ProfilerFeature::Threads;
}
// Some features imply others. // Some features imply others.
if (aFeatures & ProfilerFeature::FileIOAll) { if (aFeatures & ProfilerFeature::FileIOAll) {
aFeatures |= ProfilerFeature::MainThreadIO | ProfilerFeature::FileIO; aFeatures |= ProfilerFeature::MainThreadIO | ProfilerFeature::FileIO;
@ -751,8 +743,7 @@ class ActivePS {
static bool ShouldProfileThread(PSLockRef aLock, ThreadInfo* aInfo) { static bool ShouldProfileThread(PSLockRef aLock, ThreadInfo* aInfo) {
MOZ_ASSERT(sInstance); MOZ_ASSERT(sInstance);
return ((aInfo->IsMainThread() || FeatureThreads(aLock)) && return sInstance->ThreadSelected(aInfo->Name());
sInstance->ThreadSelected(aInfo->Name()));
} }
PS_GET(uint32_t, Generation) PS_GET(uint32_t, Generation)

Просмотреть файл

@ -178,46 +178,44 @@ class MOZ_RAII AutoProfilerStats {
MACRO(9, "stackwalk", StackWalk, \ MACRO(9, "stackwalk", StackWalk, \
"Walk the C++ stack, not available on all platforms") \ "Walk the C++ stack, not available on all platforms") \
\ \
MACRO(10, "threads", Threads, "Profile the registered secondary threads") \ MACRO(10, "jstracer", JSTracer, "Enable tracing of the JavaScript engine") \
\ \
MACRO(11, "jstracer", JSTracer, "Enable tracing of the JavaScript engine") \ MACRO(11, "jsallocations", JSAllocations, \
\
MACRO(12, "jsallocations", JSAllocations, \
"Have the JavaScript engine track allocations") \ "Have the JavaScript engine track allocations") \
\ \
MACRO(13, "nostacksampling", NoStackSampling, \ MACRO(12, "nostacksampling", NoStackSampling, \
"Disable all stack sampling: Cancels \"js\", \"leaf\", " \ "Disable all stack sampling: Cancels \"js\", \"leaf\", " \
"\"stackwalk\" and labels") \ "\"stackwalk\" and labels") \
\ \
MACRO(14, "preferencereads", PreferenceReads, \ MACRO(13, "preferencereads", PreferenceReads, \
"Track when preferences are read") \ "Track when preferences are read") \
\ \
MACRO(15, "nativeallocations", NativeAllocations, \ MACRO(14, "nativeallocations", NativeAllocations, \
"Collect the stacks from a smaller subset of all native " \ "Collect the stacks from a smaller subset of all native " \
"allocations, biasing towards collecting larger allocations") \ "allocations, biasing towards collecting larger allocations") \
\ \
MACRO(16, "ipcmessages", IPCMessages, \ MACRO(15, "ipcmessages", IPCMessages, \
"Have the IPC layer track cross-process messages") \ "Have the IPC layer track cross-process messages") \
\ \
MACRO(17, "audiocallbacktracing", AudioCallbackTracing, \ MACRO(16, "audiocallbacktracing", AudioCallbackTracing, \
"Audio callback tracing") \ "Audio callback tracing") \
\ \
MACRO(18, "cpu", CPUUtilization, "CPU utilization") \ MACRO(17, "cpu", CPUUtilization, "CPU utilization") \
\ \
MACRO(19, "notimerresolutionchange", NoTimerResolutionChange, \ MACRO(18, "notimerresolutionchange", NoTimerResolutionChange, \
"Do not adjust the timer resolution for fast sampling, so that " \ "Do not adjust the timer resolution for fast sampling, so that " \
"other Firefox timers do not get affected") \ "other Firefox timers do not get affected") \
\ \
MACRO(20, "cpuallthreads", CPUAllThreads, \ MACRO(19, "cpuallthreads", CPUAllThreads, \
"Sample the CPU utilization of all registered threads") \ "Sample the CPU utilization of all registered threads") \
\ \
MACRO(21, "samplingallthreads", SamplingAllThreads, \ MACRO(20, "samplingallthreads", SamplingAllThreads, \
"Sample the stacks of all registered threads") \ "Sample the stacks of all registered threads") \
\ \
MACRO(22, "markersallthreads", MarkersAllThreads, \ MACRO(21, "markersallthreads", MarkersAllThreads, \
"Record markers from all registered threads") \ "Record markers from all registered threads") \
\ \
MACRO(23, "unregisteredthreads", UnregisteredThreads, \ MACRO(22, "unregisteredthreads", UnregisteredThreads, \
"Discover and profile unregistered threads -- beware: expensive!") "Discover and profile unregistered threads -- beware: expensive!")
// *** Synchronize with lists in ProfilerState.h and geckoProfiler.json *** // *** Synchronize with lists in ProfilerState.h and geckoProfiler.json ***

Просмотреть файл

@ -3931,8 +3931,7 @@ void TestProfiler() {
// Profile all registered threads. // Profile all registered threads.
MOZ_RELEASE_ASSERT(filters.append("")); MOZ_RELEASE_ASSERT(filters.append(""));
const uint32_t features = baseprofiler::ProfilerFeature::Leaf | const uint32_t features = baseprofiler::ProfilerFeature::Leaf |
baseprofiler::ProfilerFeature::StackWalk | baseprofiler::ProfilerFeature::StackWalk;
baseprofiler::ProfilerFeature::Threads;
baseprofiler::profiler_start(baseprofiler::BASE_PROFILER_DEFAULT_ENTRIES, baseprofiler::profiler_start(baseprofiler::BASE_PROFILER_DEFAULT_ENTRIES,
BASE_PROFILER_DEFAULT_INTERVAL, features, BASE_PROFILER_DEFAULT_INTERVAL, features,
filters.begin(), filters.length()); filters.begin(), filters.length());

Просмотреть файл

@ -382,7 +382,7 @@ async function startGeckoProfiling() {
); );
const features = geckoFeatures const features = geckoFeatures
? geckoFeatures.split(",") ? geckoFeatures.split(",")
: ["js", "leaf", "stackwalk", "cpu", "threads", "responsiveness"]; : ["js", "leaf", "stackwalk", "cpu", "responsiveness"];
await ext.geckoProfiler.start({ await ext.geckoProfiler.start({
bufferSize: geckoEntries, bufferSize: geckoEntries,
interval: geckoInterval, interval: geckoInterval,

Просмотреть файл

@ -33,7 +33,6 @@
"screenshots", "screenshots",
"seqstyle", "seqstyle",
"stackwalk", "stackwalk",
"threads",
"jstracer", "jstracer",
"jsallocations", "jsallocations",
"nostacksampling", "nostacksampling",

Просмотреть файл

@ -274,8 +274,8 @@ static uint32_t AvailableFeatures() {
// Default features common to all contexts (even if not available). // Default features common to all contexts (even if not available).
static constexpr uint32_t DefaultFeatures() { static constexpr uint32_t DefaultFeatures() {
return ProfilerFeature::Java | ProfilerFeature::JS | ProfilerFeature::Leaf | return ProfilerFeature::Java | ProfilerFeature::JS | ProfilerFeature::Leaf |
ProfilerFeature::StackWalk | ProfilerFeature::Threads | ProfilerFeature::StackWalk | ProfilerFeature::CPUUtilization |
ProfilerFeature::CPUUtilization | ProfilerFeature::Screenshots; ProfilerFeature::Screenshots;
} }
// Extra default features when MOZ_PROFILER_STARTUP is set (even if not // Extra default features when MOZ_PROFILER_STARTUP is set (even if not
@ -648,13 +648,6 @@ class ActivePS {
// Filter out any features unavailable in this platform/configuration. // Filter out any features unavailable in this platform/configuration.
aFeatures &= AvailableFeatures(); aFeatures &= AvailableFeatures();
// Always enable ProfilerFeature::Threads if we have a filter, because
// users sometimes ask to filter by a list of threads but forget to
// explicitly specify ProfilerFeature::Threads.
if (aFilterCount > 0) {
aFeatures |= ProfilerFeature::Threads;
}
// Some features imply others. // Some features imply others.
if (aFeatures & ProfilerFeature::FileIOAll) { if (aFeatures & ProfilerFeature::FileIOAll) {
aFeatures |= ProfilerFeature::MainThreadIO | ProfilerFeature::FileIO; aFeatures |= ProfilerFeature::MainThreadIO | ProfilerFeature::FileIO;
@ -846,8 +839,7 @@ class ActivePS {
static ThreadProfilingFeatures ProfilingFeaturesForThread( static ThreadProfilingFeatures ProfilingFeaturesForThread(
PSLockRef aLock, const ThreadRegistrationInfo& aInfo) { PSLockRef aLock, const ThreadRegistrationInfo& aInfo) {
MOZ_ASSERT(sInstance); MOZ_ASSERT(sInstance);
if ((aInfo.IsMainThread() || FeatureThreads(aLock)) && if (sInstance->ThreadSelected(aInfo.Name())) {
sInstance->ThreadSelected(aInfo.Name())) {
// This thread was selected by the user, record everything. // This thread was selected by the user, record everything.
return ThreadProfilingFeatures::Any; return ThreadProfilingFeatures::Any;
} }

Просмотреть файл

@ -57,46 +57,44 @@
MACRO(9, "stackwalk", StackWalk, \ MACRO(9, "stackwalk", StackWalk, \
"Walk the C++ stack, not available on all platforms") \ "Walk the C++ stack, not available on all platforms") \
\ \
MACRO(10, "threads", Threads, "Profile the registered secondary threads") \ MACRO(10, "jstracer", JSTracer, "Enable tracing of the JavaScript engine") \
\ \
MACRO(11, "jstracer", JSTracer, "Enable tracing of the JavaScript engine") \ MACRO(11, "jsallocations", JSAllocations, \
\
MACRO(12, "jsallocations", JSAllocations, \
"Have the JavaScript engine track allocations") \ "Have the JavaScript engine track allocations") \
\ \
MACRO(13, "nostacksampling", NoStackSampling, \ MACRO(12, "nostacksampling", NoStackSampling, \
"Disable all stack sampling: Cancels \"js\", \"leaf\", " \ "Disable all stack sampling: Cancels \"js\", \"leaf\", " \
"\"stackwalk\" and labels") \ "\"stackwalk\" and labels") \
\ \
MACRO(14, "preferencereads", PreferenceReads, \ MACRO(13, "preferencereads", PreferenceReads, \
"Track when preferences are read") \ "Track when preferences are read") \
\ \
MACRO(15, "nativeallocations", NativeAllocations, \ MACRO(14, "nativeallocations", NativeAllocations, \
"Collect the stacks from a smaller subset of all native " \ "Collect the stacks from a smaller subset of all native " \
"allocations, biasing towards collecting larger allocations") \ "allocations, biasing towards collecting larger allocations") \
\ \
MACRO(16, "ipcmessages", IPCMessages, \ MACRO(15, "ipcmessages", IPCMessages, \
"Have the IPC layer track cross-process messages") \ "Have the IPC layer track cross-process messages") \
\ \
MACRO(17, "audiocallbacktracing", AudioCallbackTracing, \ MACRO(16, "audiocallbacktracing", AudioCallbackTracing, \
"Audio callback tracing") \ "Audio callback tracing") \
\ \
MACRO(18, "cpu", CPUUtilization, "CPU utilization") \ MACRO(17, "cpu", CPUUtilization, "CPU utilization") \
\ \
MACRO(19, "notimerresolutionchange", NoTimerResolutionChange, \ MACRO(18, "notimerresolutionchange", NoTimerResolutionChange, \
"Do not adjust the timer resolution for sampling, so that other " \ "Do not adjust the timer resolution for sampling, so that other " \
"Firefox timers do not get affected") \ "Firefox timers do not get affected") \
\ \
MACRO(20, "cpuallthreads", CPUAllThreads, \ MACRO(19, "cpuallthreads", CPUAllThreads, \
"Sample the CPU utilization of all registered threads") \ "Sample the CPU utilization of all registered threads") \
\ \
MACRO(21, "samplingallthreads", SamplingAllThreads, \ MACRO(20, "samplingallthreads", SamplingAllThreads, \
"Sample the stacks of all registered threads") \ "Sample the stacks of all registered threads") \
\ \
MACRO(22, "markersallthreads", MarkersAllThreads, \ MACRO(21, "markersallthreads", MarkersAllThreads, \
"Record markers from all registered threads") \ "Record markers from all registered threads") \
\ \
MACRO(23, "unregisteredthreads", UnregisteredThreads, \ MACRO(22, "unregisteredthreads", UnregisteredThreads, \
"Discover and profile unregistered threads -- beware: expensive!") "Discover and profile unregistered threads -- beware: expensive!")
// *** Synchronize with lists in BaseProfilerState.h and geckoProfiler.json *** // *** Synchronize with lists in BaseProfilerState.h and geckoProfiler.json ***

Просмотреть файл

@ -32,7 +32,7 @@ add_task(async function test_profile_feature_ipcmessges() {
const url = BASE_URL + "simple.html"; const url = BASE_URL + "simple.html";
info("Open a tab while profiling IPC messages."); info("Open a tab while profiling IPC messages.");
startProfiler({ features: ["threads", "leaf", "ipcmessages"] }); startProfiler({ features: ["leaf", "ipcmessages"] });
info("Started the profiler sucessfully! Now, let's open a tab."); info("Started the profiler sucessfully! Now, let's open a tab.");
await BrowserTestUtils.withNewTab(url, async contentBrowser => { await BrowserTestUtils.withNewTab(url, async contentBrowser => {
@ -71,7 +71,7 @@ add_task(async function test_profile_feature_ipcmessges() {
}); });
info("Now open a tab without profiling IPC messages."); info("Now open a tab without profiling IPC messages.");
startProfiler({ features: ["threads", "leaf"] }); startProfiler({ features: ["leaf"] });
await BrowserTestUtils.withNewTab(url, async contentBrowser => { await BrowserTestUtils.withNewTab(url, async contentBrowser => {
const contentPid = await SpecialPowers.spawn( const contentPid = await SpecialPowers.spawn(

Просмотреть файл

@ -15,7 +15,7 @@ add_task(async function test_profile_feature_jsallocations() {
"The profiler is not currently active" "The profiler is not currently active"
); );
startProfiler({ features: ["threads", "js", "jsallocations"] }); startProfiler({ features: ["js", "jsallocations"] });
const url = BASE_URL + "do_work_500ms.html"; const url = BASE_URL + "do_work_500ms.html";
await BrowserTestUtils.withNewTab(url, async contentBrowser => { await BrowserTestUtils.withNewTab(url, async contentBrowser => {
@ -48,7 +48,7 @@ add_task(async function test_profile_feature_jsallocations() {
); );
} }
startProfiler({ features: ["threads", "js"] }); startProfiler({ features: ["js"] });
// Now reload the tab with a clean run. // Now reload the tab with a clean run.
gBrowser.reload(); gBrowser.reload();
await wait(500); await wait(500);

Просмотреть файл

@ -11,7 +11,7 @@ add_task(async function test_profile_feature_nostacksampling() {
"The profiler is not currently active" "The profiler is not currently active"
); );
startProfiler({ features: ["threads", "js", "nostacksampling"] }); startProfiler({ features: ["js", "nostacksampling"] });
const url = BASE_URL + "do_work_500ms.html"; const url = BASE_URL + "do_work_500ms.html";
await BrowserTestUtils.withNewTab(url, async contentBrowser => { await BrowserTestUtils.withNewTab(url, async contentBrowser => {
@ -46,7 +46,7 @@ add_task(async function test_profile_feature_nostacksampling() {
// Flush out any straggling allocation markers that may have not been collected // Flush out any straggling allocation markers that may have not been collected
// yet by starting and stopping the profiler once. // yet by starting and stopping the profiler once.
startProfiler({ features: ["threads", "js"] }); startProfiler({ features: ["js"] });
// Now reload the tab with a clean run. // Now reload the tab with a clean run.
gBrowser.reload(); gBrowser.reload();

Просмотреть файл

@ -40,7 +40,7 @@ add_task(async function test_profile_feature_preferencereads() {
"The profiler is not currently active" "The profiler is not currently active"
); );
startProfiler({ features: ["threads", "leaf", "preferencereads"] }); startProfiler({ features: ["leaf", "preferencereads"] });
const url = BASE_URL + "fixed_height.html"; const url = BASE_URL + "fixed_height.html";
await BrowserTestUtils.withNewTab(url, async contentBrowser => { await BrowserTestUtils.withNewTab(url, async contentBrowser => {
@ -67,7 +67,7 @@ add_task(async function test_profile_feature_preferencereads() {
); );
} }
startProfiler({ features: ["threads", "leaf"] }); startProfiler({ features: ["leaf"] });
// Now reload the tab with a clean run. // Now reload the tab with a clean run.
await ContentTask.spawn(contentBrowser, null, () => { await ContentTask.spawn(contentBrowser, null, () => {
return new Promise(resolve => { return new Promise(resolve => {

Просмотреть файл

@ -22,7 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1428076
const settings = { const settings = {
entries: 1000000, // 9MB entries: 1000000, // 9MB
interval: 1, // ms interval: 1, // ms
features: ["js", "threads", "leaf", "stackwalk", "cpu"], features: ["js", "leaf", "stackwalk", "cpu"],
threads: ["GeckoMain", "Compositor", "Worker"], // most common combination threads: ["GeckoMain", "Compositor", "Worker"], // most common combination
}; };

Просмотреть файл

@ -24,7 +24,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1428076
const settings = { const settings = {
entries: 1000000, // 9MB entries: 1000000, // 9MB
interval: 1, // ms interval: 1, // ms
features: ["js", "threads", "leaf", "stackwalk"], features: ["js", "leaf", "stackwalk"],
threads: ["GeckoMain", "Compositor", "Worker"], // most common combination threads: ["GeckoMain", "Compositor", "Worker"], // most common combination
}; };

Просмотреть файл

@ -1509,7 +1509,7 @@ TEST(GeckoProfiler, FeaturesAndParams)
// Try a couple of features and filters. // Try a couple of features and filters.
{ {
uint32_t features = ProfilerFeature::JS | ProfilerFeature::Threads; uint32_t features = ProfilerFeature::JS;
const char* filters[] = {"GeckoMain", "Compositor"}; const char* filters[] = {"GeckoMain", "Compositor"};
profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL, profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL,
@ -1545,9 +1545,7 @@ TEST(GeckoProfiler, FeaturesAndParams)
ASSERT_TRUE(profiler_feature_active(ProfilerFeature::MainThreadIO)); ASSERT_TRUE(profiler_feature_active(ProfilerFeature::MainThreadIO));
ASSERT_TRUE(profiler_feature_active(ProfilerFeature::IPCMessages)); ASSERT_TRUE(profiler_feature_active(ProfilerFeature::IPCMessages));
// Profiler::Threads is added because filters has multiple entries. ActiveParamsCheck(int(PowerOfTwo32(999999).Value()), 3, features, filters,
ActiveParamsCheck(PowerOfTwo32(999999).Value(), 3,
features | ProfilerFeature::Threads, filters,
MOZ_ARRAY_LENGTH(filters), 123, Some(25.0)); MOZ_ARRAY_LENGTH(filters), 123, Some(25.0));
profiler_stop(); profiler_stop();
@ -1568,9 +1566,7 @@ TEST(GeckoProfiler, FeaturesAndParams)
ASSERT_TRUE(profiler_feature_active(ProfilerFeature::MainThreadIO)); ASSERT_TRUE(profiler_feature_active(ProfilerFeature::MainThreadIO));
ASSERT_TRUE(profiler_feature_active(ProfilerFeature::IPCMessages)); ASSERT_TRUE(profiler_feature_active(ProfilerFeature::IPCMessages));
// Profiler::Threads is added because filters has multiple entries. ActiveParamsCheck(int(PowerOfTwo32(999999).Value()), 3, features, filters,
ActiveParamsCheck(PowerOfTwo32(999999).Value(), 3,
features | ProfilerFeature::Threads, filters,
MOZ_ARRAY_LENGTH(filters), 0, Nothing()); MOZ_ARRAY_LENGTH(filters), 0, Nothing());
profiler_stop(); profiler_stop();
@ -1612,8 +1608,7 @@ TEST(GeckoProfiler, FeaturesAndParams)
// Entries and intervals go to defaults if 0 is specified. // Entries and intervals go to defaults if 0 is specified.
ActiveParamsCheck(PROFILER_DEFAULT_ENTRIES.Value(), ActiveParamsCheck(PROFILER_DEFAULT_ENTRIES.Value(),
PROFILER_DEFAULT_INTERVAL, PROFILER_DEFAULT_INTERVAL, features, filters,
features | ProfilerFeature::Threads, filters,
MOZ_ARRAY_LENGTH(filters), 0, Nothing()); MOZ_ARRAY_LENGTH(filters), 0, Nothing());
profiler_stop(); profiler_stop();
@ -1632,7 +1627,7 @@ TEST(GeckoProfiler, EnsureStarted)
{ {
InactiveFeaturesAndParamsCheck(); InactiveFeaturesAndParamsCheck();
uint32_t features = ProfilerFeature::JS | ProfilerFeature::Threads; uint32_t features = ProfilerFeature::JS;
const char* filters[] = {"GeckoMain", "Compositor"}; const char* filters[] = {"GeckoMain", "Compositor"};
{ {
// Inactive -> Active // Inactive -> Active
@ -1770,7 +1765,7 @@ TEST(GeckoProfiler, DifferentThreads)
// Control the profiler on a background thread and verify flags on the // Control the profiler on a background thread and verify flags on the
// main thread. // main thread.
{ {
uint32_t features = ProfilerFeature::JS | ProfilerFeature::Threads; uint32_t features = ProfilerFeature::JS;
const char* filters[] = {"GeckoMain", "Compositor"}; const char* filters[] = {"GeckoMain", "Compositor"};
thread->Dispatch( thread->Dispatch(
@ -1802,7 +1797,7 @@ TEST(GeckoProfiler, DifferentThreads)
// Control the profiler on the main thread and verify flags on a // Control the profiler on the main thread and verify flags on a
// background thread. // background thread.
{ {
uint32_t features = ProfilerFeature::JS | ProfilerFeature::Threads; uint32_t features = ProfilerFeature::JS;
const char* filters[] = {"GeckoMain", "Compositor"}; const char* filters[] = {"GeckoMain", "Compositor"};
profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL, profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL,
@ -3348,7 +3343,7 @@ PROFILER_DEFINE_COUNT_TOTAL(TestCounter2, COUNTER_NAME2, COUNTER_DESCRIPTION2);
TEST(GeckoProfiler, Counters) TEST(GeckoProfiler, Counters)
{ {
uint32_t features = ProfilerFeature::Threads; uint32_t features = 0;
const char* filters[] = {"GeckoMain"}; const char* filters[] = {"GeckoMain"};
// We will record some counter values, and check that they're present (and no // We will record some counter values, and check that they're present (and no
@ -3514,8 +3509,6 @@ TEST(GeckoProfiler, GetProfile)
ASSERT_TRUE(activeFeatures.isSome()); ASSERT_TRUE(activeFeatures.isSome());
// Not all platforms support stack-walking. // Not all platforms support stack-walking.
const bool hasStackWalk = ProfilerFeature::HasStackWalk(*activeFeatures); const bool hasStackWalk = ProfilerFeature::HasStackWalk(*activeFeatures);
// "threads" may automatically be added when `filters` is not empty.
const bool hasThreads = ProfilerFeature::HasThreads(*activeFeatures);
UniquePtr<char[]> profile = profiler_get_profile(); UniquePtr<char[]> profile = profiler_get_profile();
JSONOutputCheck(profile.get(), [&](const Json::Value& aRoot) { JSONOutputCheck(profile.get(), [&](const Json::Value& aRoot) {
@ -3525,14 +3518,10 @@ TEST(GeckoProfiler, GetProfile)
{ {
GET_JSON(features, configuration["features"], Array); GET_JSON(features, configuration["features"], Array);
{ {
EXPECT_EQ(features.size(), EXPECT_EQ(features.size(), (hasStackWalk ? 1u : 0u));
(hasStackWalk ? 1u : 0u) + (hasThreads ? 1u : 0u));
if (hasStackWalk) { if (hasStackWalk) {
EXPECT_JSON_ARRAY_CONTAINS(features, String, "stackwalk"); EXPECT_JSON_ARRAY_CONTAINS(features, String, "stackwalk");
} }
if (hasThreads) {
EXPECT_JSON_ARRAY_CONTAINS(features, String, "threads");
}
} }
GET_JSON(threads, configuration["threads"], Array); GET_JSON(threads, configuration["threads"], Array);
{ {
@ -3735,7 +3724,7 @@ TEST(GeckoProfiler, SuspendAndSample)
DoSuspendAndSample(ProfilerThreadId{}, thread); DoSuspendAndSample(ProfilerThreadId{}, thread);
uint32_t features = ProfilerFeature::JS | ProfilerFeature::Threads; uint32_t features = ProfilerFeature::JS;
const char* filters[] = {"GeckoMain", "Compositor"}; const char* filters[] = {"GeckoMain", "Compositor"};
profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL, features, profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL, features,
@ -4402,7 +4391,7 @@ TEST(GeckoProfiler, AllThreads)
ASSERT_TRUE(!profiler_is_active()); ASSERT_TRUE(!profiler_is_active());
uint32_t features = ProfilerFeature::StackWalk | ProfilerFeature::Threads; uint32_t features = ProfilerFeature::StackWalk;
std::string featuresString = "Features: StackWalk Threads"; std::string featuresString = "Features: StackWalk Threads";
if (threadCPU) { if (threadCPU) {
features |= ProfilerFeature::CPUAllThreads; features |= ProfilerFeature::CPUAllThreads;

Просмотреть файл

@ -21,7 +21,7 @@ var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const defaultSettings = { const defaultSettings = {
entries: 8 * 1024 * 1024, // 8M entries = 64MB entries: 8 * 1024 * 1024, // 8M entries = 64MB
interval: 1, // ms interval: 1, // ms
features: ["threads"], features: [],
threads: ["GeckoMain"], threads: ["GeckoMain"],
}; };
@ -44,7 +44,7 @@ function startProfiler(callersSettings) {
function startProfilerForMarkerTests() { function startProfilerForMarkerTests() {
startProfiler({ startProfiler({
features: ["threads", "nostacksampling", "js"], features: ["nostacksampling", "js"],
threads: ["GeckoMain", "DOM Worker"], threads: ["GeckoMain", "DOM Worker"],
}); });
} }

Просмотреть файл

@ -19,7 +19,7 @@ function run_test() {
const entries = 10000; const entries = 10000;
const interval = 1; const interval = 1;
const threads = ["GeckoMain"]; const threads = ["GeckoMain"];
const features = ["js", "leaf", "threads"]; const features = ["js", "leaf"];
const activeTabID = 123; const activeTabID = 123;
Services.profiler.StartProfiler( Services.profiler.StartProfiler(
entries, entries,
@ -61,7 +61,7 @@ function run_test() {
const entries = 20000; const entries = 20000;
const interval = 0.5; const interval = 0.5;
const threads = ["GeckoMain", "DOM Worker"]; const threads = ["GeckoMain", "DOM Worker"];
const features = ["threads"]; const features = [];
const activeTabID = 111; const activeTabID = 111;
const duration = 20; const duration = 20;

Просмотреть файл

@ -26,7 +26,7 @@ add_task(async () => {
startProfiler({ startProfiler({
// Only instrument the main thread. // Only instrument the main thread.
threads: ["GeckoMain"], threads: ["GeckoMain"],
features: ["threads", "leaf", "nativeallocations"], features: ["leaf", "nativeallocations"],
}); });
info( info(
@ -71,7 +71,7 @@ add_task(async () => {
info("Restart the profiler, to ensure that we get no more allocations."); info("Restart the profiler, to ensure that we get no more allocations.");
{ {
startProfiler({ features: ["threads", "leaf"] }); startProfiler({ features: ["leaf"] });
info("Do some work again."); info("Do some work again.");
doWork(); doWork();
info("Wait for the periodic sampling."); info("Wait for the periodic sampling.");