Bug 1540114 - Select all defaults in MOZ_PROFILER_STARTUP_FEATURES with keyword "default" - r=mstange

MOZ_PROFILER_FEATURES is mostly used to add features in addition to the
defaults. This will now be easier, e.g.:
`MOZ_PROFILER_STARTUP_FEATURES=default,screenshots`

Differential Revision: https://phabricator.services.mozilla.com/D25532

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gerald Squelart 2019-04-30 01:41:19 +00:00
Родитель fd32cddd4c
Коммит 5919d66cd1
2 изменённых файлов: 15 добавлений и 5 удалений

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

@ -2256,6 +2256,7 @@ static void PrintUsageThenExit(int aExitCode) {
#undef PRINT_FEATURE
printf(
" - \"default\" (All above D+S defaults)\n"
"\n"
" MOZ_PROFILER_STARTUP_FILTERS=<Filters>\n"
" If MOZ_PROFILER_STARTUP is set, specifies the thread filters, as a\n"
@ -2628,7 +2629,13 @@ GeckoProfilerReporter::CollectReports(nsIHandleReportCallback* aHandleReport,
NS_IMPL_ISUPPORTS(GeckoProfilerReporter, nsIMemoryReporter)
static uint32_t ParseFeature(const char* aFeature) {
static uint32_t ParseFeature(const char* aFeature, bool aIsStartup) {
if (strcmp(aFeature, "default") == 0) {
return (aIsStartup ? (DefaultFeatures() | StartupExtraDefaultFeatures())
: DefaultFeatures()) &
AvailableFeatures();
}
#define PARSE_FEATURE_BIT(n_, str_, Name_, desc_) \
if (strcmp(aFeature, str_) == 0) { \
return ProfilerFeature::Name_; \
@ -2644,10 +2651,11 @@ static uint32_t ParseFeature(const char* aFeature) {
}
uint32_t ParseFeaturesFromStringArray(const char** aFeatures,
uint32_t aFeatureCount) {
uint32_t aFeatureCount,
bool aIsStartup /* = false */) {
uint32_t features = 0;
for (size_t i = 0; i < aFeatureCount; i++) {
features |= ParseFeature(aFeatures[i]);
features |= ParseFeature(aFeatures[i], aIsStartup);
}
return features;
}
@ -2927,7 +2935,8 @@ void profiler_init(void* aStackTop) {
Vector<const char*> featureStringArray =
SplitAtCommas(startupFeatures, featureStringStorage);
features = ParseFeaturesFromStringArray(featureStringArray.begin(),
featureStringArray.length());
featureStringArray.length(),
/* aIsStartup */ true);
LOG("- MOZ_PROFILER_STARTUP_FEATURES = %d", features);
}
}

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

@ -111,7 +111,8 @@ void AppendSharedLibraries(mozilla::JSONWriter& aWriter);
// Convert the array of strings to a bitfield.
uint32_t ParseFeaturesFromStringArray(const char** aFeatures,
uint32_t aFeatureCount);
uint32_t aFeatureCount,
bool aIsStartup = false);
void profiler_get_profile_json_into_lazily_allocated_buffer(
const std::function<char*(size_t)>& aAllocator, double aSinceTime,