Bug 1340327 - Set bools earlier in profiler_start(). r=mstange.

They must be set before the call to MaybeSetProfiler(), which checks
gProfileThreads, and before the gTaskTracer check.

This patch fixes the failure of some threads (e.g. Compositor) to be profiled,
as well as allowing TaskTracer to start up again!
This commit is contained in:
Nicholas Nethercote 2017-02-18 10:16:47 +11:00
Родитель 27c7974fe9
Коммит e3efc284a6
1 изменённых файлов: 24 добавлений и 23 удалений

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

@ -1995,7 +1995,7 @@ profiler_start(int aProfileEntries, double aInterval,
profiler_stop();
// Deep copy aThreadNameFilters. Must happen before the MaybeSetProfile()
// calls below.
// call below.
{
StaticMutexAutoLock lock(gThreadNameFiltersMutex);
@ -2011,6 +2011,29 @@ profiler_start(int aProfileEntries, double aInterval,
gFeatures[i] = aFeatures[i];
}
bool mainThreadIO = hasFeature(aFeatures, aFeatureCount, "mainthreadio");
bool privacyMode = hasFeature(aFeatures, aFeatureCount, "privacy");
#if defined(PROFILE_JAVA)
gProfileJava = mozilla::jni::IsFennec() &&
hasFeature(aFeatures, aFeatureCount, "java");
#endif
gProfileJS = hasFeature(aFeatures, aFeatureCount, "js");
gTaskTracer = hasFeature(aFeatures, aFeatureCount, "tasktracer");
gAddLeafAddresses = hasFeature(aFeatures, aFeatureCount, "leaf");
gDisplayListDump = hasFeature(aFeatures, aFeatureCount, "displaylistdump");
gLayersDump = hasFeature(aFeatures, aFeatureCount, "layersdump");
gProfileGPU = hasFeature(aFeatures, aFeatureCount, "gpu");
gProfileMemory = hasFeature(aFeatures, aFeatureCount, "memory");
gProfileRestyle = hasFeature(aFeatures, aFeatureCount, "restyle");
// Profile non-main threads if we have a filter, because users sometimes ask
// to filter by a list of threads but forget to explicitly request.
// gProfileThreads must be set before the MaybeSetProfile() call below.
gProfileThreads = hasFeature(aFeatures, aFeatureCount, "threads") ||
aFilterCount > 0;
gUseStackWalk = hasFeature(aFeatures, aFeatureCount, "stackwalk");
gEntrySize = aProfileEntries ? aProfileEntries : PROFILE_DEFAULT_ENTRY;
gInterval = aInterval ? aInterval : PROFILE_DEFAULT_INTERVAL;
gBuffer = new ProfileBuffer(gEntrySize);
@ -2038,28 +2061,6 @@ profiler_start(int aProfileEntries, double aInterval,
gGatherer = new mozilla::ProfileGatherer(gSampler);
bool mainThreadIO = hasFeature(aFeatures, aFeatureCount, "mainthreadio");
bool privacyMode = hasFeature(aFeatures, aFeatureCount, "privacy");
#if defined(PROFILE_JAVA)
gProfileJava = mozilla::jni::IsFennec() &&
hasFeature(aFeatures, aFeatureCount, "java");
#endif
gProfileJS = hasFeature(aFeatures, aFeatureCount, "js");
gTaskTracer = hasFeature(aFeatures, aFeatureCount, "tasktracer");
gAddLeafAddresses = hasFeature(aFeatures, aFeatureCount, "leaf");
gDisplayListDump = hasFeature(aFeatures, aFeatureCount, "displaylistdump");
gLayersDump = hasFeature(aFeatures, aFeatureCount, "layersdump");
gProfileGPU = hasFeature(aFeatures, aFeatureCount, "gpu");
gProfileMemory = hasFeature(aFeatures, aFeatureCount, "memory");
gProfileRestyle = hasFeature(aFeatures, aFeatureCount, "restyle");
// Profile non-main threads if we have a filter, because users sometimes ask
// to filter by a list of threads but forget to explicitly request.
gProfileThreads = hasFeature(aFeatures, aFeatureCount, "threads") ||
aFilterCount > 0;
gUseStackWalk = hasFeature(aFeatures, aFeatureCount, "stackwalk");
MOZ_ASSERT(!gIsActive && !gIsPaused);
PlatformStart();
MOZ_ASSERT(gIsActive && !gIsPaused); // PlatformStart() sets gIsActive.