Bug 1569871 - MOZ_PROFILER_STARTUP set to ''/'0'/'N'/'n' does not start the profiler - r=canaltinova

(Also MOZ_BASE_PROFILER_STARTUP.)

This makes it easier to keep that variable setup in the environment, and change
its value to switch between enabling and disabling the profiler.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gerald Squelart 2019-08-19 08:36:28 +00:00
Родитель 54381141f5
Коммит 16f6820be1
2 изменённых файлов: 12 добавлений и 4 удалений

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

@ -1726,7 +1726,8 @@ static void PrintUsageThenExit(int aExitCode) {
" '..._VERBOSE_LOGGING' (most verbose)\n"
"\n"
" MOZ_BASE_PROFILER_STARTUP\n"
" If set to any value, starts the profiler immediately on start-up.\n"
" If set to any value other than '' or '0'/'N'/'n', starts the\n"
" profiler immediately on start-up.\n"
" Useful if you want profile code that runs very early.\n"
"\n"
" MOZ_BASE_PROFILER_STARTUP_ENTRIES=<1..>\n"
@ -2244,7 +2245,10 @@ void profiler_init(void* aStackTop) {
// created on demand at the first call to PlatformStart().
const char* startupEnv = getenv("MOZ_BASE_PROFILER_STARTUP");
if (!startupEnv || startupEnv[0] == '\0') {
if (!startupEnv || startupEnv[0] == '\0' ||
((startupEnv[0] == '0' || startupEnv[0] == 'N' ||
startupEnv[0] == 'n') &&
startupEnv[1] == '\0')) {
return;
}

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

@ -2274,7 +2274,8 @@ static void PrintUsageThenExit(int aExitCode) {
" 'prof:3' (least verbose), 'prof:4', 'prof:5' (most verbose).\n"
"\n"
" MOZ_PROFILER_STARTUP\n"
" If set to any value, starts the profiler immediately on start-up.\n"
" If set to any value other than '' or '0'/'N'/'n', starts the\n"
" profiler immediately on start-up.\n"
" Useful if you want profile code that runs very early.\n"
"\n"
" MOZ_PROFILER_STARTUP_ENTRIES=<1..>\n"
@ -2907,7 +2908,10 @@ void profiler_init(void* aStackTop) {
// created on demand at the first call to PlatformStart().
const char* startupEnv = getenv("MOZ_PROFILER_STARTUP");
if (!startupEnv || startupEnv[0] == '\0') {
if (!startupEnv || startupEnv[0] == '\0' ||
((startupEnv[0] == '0' || startupEnv[0] == 'N' ||
startupEnv[0] == 'n') &&
startupEnv[1] == '\0')) {
return;
}