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",
"cpu",
"responsiveness",
"threads",
"leaf",
],
threads: options.threads || ["GeckoMain", "Compositor"],

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

@ -231,8 +231,7 @@ static uint32_t AvailableFeatures() {
// Default features common to all contexts (even if not available).
static constexpr uint32_t DefaultFeatures() {
return ProfilerFeature::Java | ProfilerFeature::JS | ProfilerFeature::Leaf |
ProfilerFeature::StackWalk | ProfilerFeature::Threads |
ProfilerFeature::CPUUtilization;
ProfilerFeature::StackWalk | ProfilerFeature::CPUUtilization;
}
// 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.
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.
if (aFeatures & ProfilerFeature::FileIOAll) {
aFeatures |= ProfilerFeature::MainThreadIO | ProfilerFeature::FileIO;
@ -751,8 +743,7 @@ class ActivePS {
static bool ShouldProfileThread(PSLockRef aLock, ThreadInfo* aInfo) {
MOZ_ASSERT(sInstance);
return ((aInfo->IsMainThread() || FeatureThreads(aLock)) &&
sInstance->ThreadSelected(aInfo->Name()));
return sInstance->ThreadSelected(aInfo->Name());
}
PS_GET(uint32_t, Generation)

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

@ -178,46 +178,44 @@ class MOZ_RAII AutoProfilerStats {
MACRO(9, "stackwalk", StackWalk, \
"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(12, "jsallocations", JSAllocations, \
MACRO(11, "jsallocations", JSAllocations, \
"Have the JavaScript engine track allocations") \
\
MACRO(13, "nostacksampling", NoStackSampling, \
MACRO(12, "nostacksampling", NoStackSampling, \
"Disable all stack sampling: Cancels \"js\", \"leaf\", " \
"\"stackwalk\" and labels") \
\
MACRO(14, "preferencereads", PreferenceReads, \
MACRO(13, "preferencereads", PreferenceReads, \
"Track when preferences are read") \
\
MACRO(15, "nativeallocations", NativeAllocations, \
MACRO(14, "nativeallocations", NativeAllocations, \
"Collect the stacks from a smaller subset of all native " \
"allocations, biasing towards collecting larger allocations") \
\
MACRO(16, "ipcmessages", IPCMessages, \
MACRO(15, "ipcmessages", IPCMessages, \
"Have the IPC layer track cross-process messages") \
\
MACRO(17, "audiocallbacktracing", AudioCallbackTracing, \
MACRO(16, "audiocallbacktracing", AudioCallbackTracing, \
"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 " \
"other Firefox timers do not get affected") \
\
MACRO(20, "cpuallthreads", CPUAllThreads, \
MACRO(19, "cpuallthreads", CPUAllThreads, \
"Sample the CPU utilization of all registered threads") \
\
MACRO(21, "samplingallthreads", SamplingAllThreads, \
MACRO(20, "samplingallthreads", SamplingAllThreads, \
"Sample the stacks of all registered threads") \
\
MACRO(22, "markersallthreads", MarkersAllThreads, \
MACRO(21, "markersallthreads", MarkersAllThreads, \
"Record markers from all registered threads") \
\
MACRO(23, "unregisteredthreads", UnregisteredThreads, \
MACRO(22, "unregisteredthreads", UnregisteredThreads, \
"Discover and profile unregistered threads -- beware: expensive!")
// *** Synchronize with lists in ProfilerState.h and geckoProfiler.json ***

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

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

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

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

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

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

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

@ -274,8 +274,8 @@ static uint32_t AvailableFeatures() {
// Default features common to all contexts (even if not available).
static constexpr uint32_t DefaultFeatures() {
return ProfilerFeature::Java | ProfilerFeature::JS | ProfilerFeature::Leaf |
ProfilerFeature::StackWalk | ProfilerFeature::Threads |
ProfilerFeature::CPUUtilization | ProfilerFeature::Screenshots;
ProfilerFeature::StackWalk | ProfilerFeature::CPUUtilization |
ProfilerFeature::Screenshots;
}
// 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.
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.
if (aFeatures & ProfilerFeature::FileIOAll) {
aFeatures |= ProfilerFeature::MainThreadIO | ProfilerFeature::FileIO;
@ -846,8 +839,7 @@ class ActivePS {
static ThreadProfilingFeatures ProfilingFeaturesForThread(
PSLockRef aLock, const ThreadRegistrationInfo& aInfo) {
MOZ_ASSERT(sInstance);
if ((aInfo.IsMainThread() || FeatureThreads(aLock)) &&
sInstance->ThreadSelected(aInfo.Name())) {
if (sInstance->ThreadSelected(aInfo.Name())) {
// This thread was selected by the user, record everything.
return ThreadProfilingFeatures::Any;
}

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

@ -57,46 +57,44 @@
MACRO(9, "stackwalk", StackWalk, \
"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(12, "jsallocations", JSAllocations, \
MACRO(11, "jsallocations", JSAllocations, \
"Have the JavaScript engine track allocations") \
\
MACRO(13, "nostacksampling", NoStackSampling, \
MACRO(12, "nostacksampling", NoStackSampling, \
"Disable all stack sampling: Cancels \"js\", \"leaf\", " \
"\"stackwalk\" and labels") \
\
MACRO(14, "preferencereads", PreferenceReads, \
MACRO(13, "preferencereads", PreferenceReads, \
"Track when preferences are read") \
\
MACRO(15, "nativeallocations", NativeAllocations, \
MACRO(14, "nativeallocations", NativeAllocations, \
"Collect the stacks from a smaller subset of all native " \
"allocations, biasing towards collecting larger allocations") \
\
MACRO(16, "ipcmessages", IPCMessages, \
MACRO(15, "ipcmessages", IPCMessages, \
"Have the IPC layer track cross-process messages") \
\
MACRO(17, "audiocallbacktracing", AudioCallbackTracing, \
MACRO(16, "audiocallbacktracing", AudioCallbackTracing, \
"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 " \
"Firefox timers do not get affected") \
\
MACRO(20, "cpuallthreads", CPUAllThreads, \
MACRO(19, "cpuallthreads", CPUAllThreads, \
"Sample the CPU utilization of all registered threads") \
\
MACRO(21, "samplingallthreads", SamplingAllThreads, \
MACRO(20, "samplingallthreads", SamplingAllThreads, \
"Sample the stacks of all registered threads") \
\
MACRO(22, "markersallthreads", MarkersAllThreads, \
MACRO(21, "markersallthreads", MarkersAllThreads, \
"Record markers from all registered threads") \
\
MACRO(23, "unregisteredthreads", UnregisteredThreads, \
MACRO(22, "unregisteredthreads", UnregisteredThreads, \
"Discover and profile unregistered threads -- beware: expensive!")
// *** 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";
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.");
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.");
startProfiler({ features: ["threads", "leaf"] });
startProfiler({ features: ["leaf"] });
await BrowserTestUtils.withNewTab(url, async contentBrowser => {
const contentPid = await SpecialPowers.spawn(

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

@ -15,7 +15,7 @@ add_task(async function test_profile_feature_jsallocations() {
"The profiler is not currently active"
);
startProfiler({ features: ["threads", "js", "jsallocations"] });
startProfiler({ features: ["js", "jsallocations"] });
const url = BASE_URL + "do_work_500ms.html";
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.
gBrowser.reload();
await wait(500);

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

@ -11,7 +11,7 @@ add_task(async function test_profile_feature_nostacksampling() {
"The profiler is not currently active"
);
startProfiler({ features: ["threads", "js", "nostacksampling"] });
startProfiler({ features: ["js", "nostacksampling"] });
const url = BASE_URL + "do_work_500ms.html";
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
// yet by starting and stopping the profiler once.
startProfiler({ features: ["threads", "js"] });
startProfiler({ features: ["js"] });
// Now reload the tab with a clean run.
gBrowser.reload();

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

@ -40,7 +40,7 @@ add_task(async function test_profile_feature_preferencereads() {
"The profiler is not currently active"
);
startProfiler({ features: ["threads", "leaf", "preferencereads"] });
startProfiler({ features: ["leaf", "preferencereads"] });
const url = BASE_URL + "fixed_height.html";
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.
await ContentTask.spawn(contentBrowser, null, () => {
return new Promise(resolve => {

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

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

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

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

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

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

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

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

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

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

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

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