Backed out 2 changesets (bug 1586939) for causing perma bc failures in automation.py CLOSED TREE
authorshindli <shindli@mozilla.com>
Thu, 16 Jan 2020 09:51:49 +0200
changeset 510445 7541d616ff870d570476299c5985ca2c49b758b6
parent 510444 c697754d9059bfc503eba58a3f9a423607d9c1e9
child 510446 7e0886a94d70b8696d6fc0481d9f9ae12b85c41a
child 510447 cad98a4f76b3abd08ab9af0ef87abe2687a04fc5
push id37021
push userrmaries@mozilla.com
push dateThu, 16 Jan 2020 09:46:51 +0000
treeherdermozilla-central@7541d616ff87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1586939
milestone74.0a1
backs out9222433458072c6e042ea0e1d3d1c0d604b69a0f
b5aac83f7f4fbb8b3f6eb6eeaeafda286515fe67
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1586939) for causing perma bc failures in automation.py CLOSED TREE Backed out changeset 922243345807 (bug 1586939) Backed out changeset b5aac83f7f4f (bug 1586939)
mozglue/baseprofiler/core/ProfileBufferEntry.cpp
mozglue/baseprofiler/core/platform.cpp
mozglue/baseprofiler/public/BaseProfiler.h
tools/profiler/core/platform.cpp
--- a/mozglue/baseprofiler/core/ProfileBufferEntry.cpp
+++ b/mozglue/baseprofiler/core/ProfileBufferEntry.cpp
@@ -651,21 +651,21 @@ void ProfileBuffer::StreamSamplesToJSON(
           static const uint32_t BUF_SIZE = 256;
           char buf[BUF_SIZE];
 
           // Bug 753041: We need a double cast here to tell GCC that we don't
           // want to sign extend 32-bit addresses starting with 0xFXXXXXX.
           unsigned long long pcULL = (unsigned long long)(uintptr_t)pc;
           SprintfLiteral(buf, "%#llx", pcULL);
 
-          // If the "MOZ_PROFILER_SYMBOLICATE" env-var is set, we add a local
-          // symbolication description to the PC address. This is off by
+          // If the "MOZ_BASE_PROFILER_SYMBOLICATE" env-var is set, we add a
+          // local symbolication description to the PC address. This is off by
           // default, and mainly intended for local development.
           static const bool preSymbolicate = []() {
-            const char* symbolicate = getenv("MOZ_PROFILER_SYMBOLICATE");
+            const char* symbolicate = getenv("MOZ_BASE_PROFILER_SYMBOLICATE");
             return symbolicate && symbolicate[0] != '\0';
           }();
           if (preSymbolicate) {
             MozCodeAddressDetails details;
             if (MozDescribeCodeAddress(pc, &details)) {
               // Replace \0 terminator with space.
               const uint32_t pcLen = strlen(buf);
               buf[pcLen] = ' ';
--- a/mozglue/baseprofiler/core/platform.cpp
+++ b/mozglue/baseprofiler/core/platform.cpp
@@ -55,17 +55,16 @@
 #  include "mozilla/TimeStamp.h"
 #  include "mozilla/Tuple.h"
 #  include "mozilla/UniquePtr.h"
 #  include "mozilla/Vector.h"
 #  include "prdtoa.h"
 #  include "prtime.h"
 
 #  include <algorithm>
-#  include <cmath>
 #  include <errno.h>
 #  include <fstream>
 #  include <ostream>
 #  include <sstream>
 
 // Win32 builds always have frame pointers, so FramePointerStackWalk() always
 // works.
 #  if defined(GP_PLAT_x86_windows)
@@ -186,17 +185,17 @@ static uint32_t AvailableFeatures() {
 }
 
 // Default features common to all contexts (even if not available).
 static uint32_t DefaultFeatures() {
   return ProfilerFeature::Java | ProfilerFeature::JS | ProfilerFeature::Leaf |
          ProfilerFeature::StackWalk | ProfilerFeature::Threads;
 }
 
-// Extra default features when MOZ_PROFILER_STARTUP is set (even if not
+// Extra default features when MOZ_BASE_PROFILER_STARTUP is set (even if not
 // available).
 static uint32_t StartupExtraDefaultFeatures() {
   // Enable mainthreadio by default for startup profiles as startup is heavy on
   // I/O operations, and main thread I/O is really important to see there.
   return ProfilerFeature::MainThreadIO;
 }
 
 // The auto-lock/unlock mutex that guards accesses to CorePS and ActivePS.
@@ -1804,63 +1803,62 @@ static char FeatureCategory(uint32_t aFe
 
 static void PrintUsageThenExit(int aExitCode) {
   printf(
       "\n"
       "Profiler environment variable usage:\n"
       "\n"
       "  MOZ_BASE_PROFILER_HELP\n"
       "  If set to any value, prints this message.\n"
-      "  (Only BaseProfiler features are known here; Use MOZ_PROFILER_HELP\n"
-      "  for Gecko Profiler help, with more features).\n"
+      "  Use MOZ_PROFILER_HELP for Gecko Profiler help.\n"
       "\n"
       "  MOZ_BASE_PROFILER_{,DEBUG_,VERBOSE}LOGGING\n"
-      "  Enables BaseProfiler logging to stdout. The levels of logging\n"
-      "  available are MOZ_BASE_PROFILER_LOGGING' (least verbose),\n"
-      "  '..._DEBUG_LOGGING', '..._VERBOSE_LOGGING' (most verbose)\n"
+      "  Enables logging to stdout. The levels of logging available are\n"
+      "  'MOZ_BASE_PROFILER_LOGGING' (least verbose), '..._DEBUG_LOGGING',\n"
+      "  '..._VERBOSE_LOGGING' (most verbose)\n"
       "\n"
-      "  MOZ_PROFILER_STARTUP\n"
+      "  MOZ_BASE_PROFILER_STARTUP\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"
-      "  If MOZ_PROFILER_STARTUP is set, specifies the number of entries\n"
+      "  MOZ_BASE_PROFILER_STARTUP_ENTRIES=<1..>\n"
+      "  If MOZ_BASE_PROFILER_STARTUP is set, specifies the number of entries\n"
       "  per process in the profiler's circular buffer when the profiler is\n"
       "  first started.\n"
       "  If unset, the platform default is used:\n"
-      "  %u entries per process, or %u when MOZ_PROFILER_STARTUP is set.\n"
+      "  %u entries per process, or %u when MOZ_BASE_PROFILER_STARTUP is set.\n"
       "  (8 bytes per entry -> %u or %u total bytes per process)\n"
       "\n"
-      "  MOZ_PROFILER_STARTUP_DURATION=<1..>\n"
-      "  If MOZ_PROFILER_STARTUP is set, specifies the maximum life time\n"
+      "  MOZ_BASE_PROFILER_STARTUP_DURATION=<1..>\n"
+      "  If MOZ_BASE_PROFILER_STARTUP is set, specifies the maximum life time\n"
       "  of entries in the the profiler's circular buffer when the profiler\n"
       "  is first started, in seconds.\n"
       "  If unset, the life time of the entries will only be restricted by\n"
-      "  MOZ_PROFILER_STARTUP_ENTRIES (or its default value), and no\n"
+      "  MOZ_BASE_PROFILER_STARTUP_ENTRIES (or its default value), and no\n"
       "  additional time duration restriction will be applied.\n"
       "\n"
-      "  MOZ_PROFILER_STARTUP_INTERVAL=<1..1000>\n"
-      "  If MOZ_PROFILER_STARTUP is set, specifies the sample interval,\n"
+      "  MOZ_BASE_PROFILER_STARTUP_INTERVAL=<1..1000>\n"
+      "  If MOZ_BASE_PROFILER_STARTUP is set, specifies the sample interval,\n"
       "  measured in milliseconds, when the profiler is first started.\n"
       "  If unset, the platform default is used.\n"
       "\n"
-      "  MOZ_PROFILER_STARTUP_FEATURES_BITFIELD=<Number>\n"
-      "  If MOZ_PROFILER_STARTUP is set, specifies the profiling\n"
+      "  MOZ_BASE_PROFILER_STARTUP_FEATURES_BITFIELD=<Number>\n"
+      "  If MOZ_BASE_PROFILER_STARTUP is set, specifies the profiling\n"
       "  features, as the integer value of the features bitfield.\n"
-      "  If unset, the value from MOZ_PROFILER_STARTUP_FEATURES is used.\n"
+      "  If unset, the value from MOZ_BASE_PROFILER_STARTUP_FEATURES is used.\n"
       "\n"
-      "  MOZ_PROFILER_STARTUP_FEATURES=<Features>\n"
-      "  If MOZ_PROFILER_STARTUP is set, specifies the profiling\n"
+      "  MOZ_BASE_PROFILER_STARTUP_FEATURES=<Features>\n"
+      "  If MOZ_BASE_PROFILER_STARTUP is set, specifies the profiling\n"
       "  features, as a comma-separated list of strings.\n"
-      "  Ignored if MOZ_PROFILER_STARTUP_FEATURES_BITFIELD is set.\n"
+      "  Ignored if MOZ_BASE_PROFILER_STARTUP_FEATURES_BITFIELD is set.\n"
       "  If unset, the platform default is used.\n"
       "\n"
       "    Features: (x=unavailable, D/d=default/unavailable,\n"
-      "               S/s=MOZ_PROFILER_STARTUP extra "
+      "               S/s=MOZ_BASE_PROFILER_STARTUP extra "
       "default/unavailable)\n",
       unsigned(BASE_PROFILER_DEFAULT_ENTRIES.Value()),
       unsigned(BASE_PROFILER_DEFAULT_STARTUP_ENTRIES.Value()),
       unsigned(BASE_PROFILER_DEFAULT_ENTRIES.Value() * 8),
       unsigned(BASE_PROFILER_DEFAULT_STARTUP_ENTRIES.Value() * 8));
 
 #  define PRINT_FEATURE(n_, str_, Name_, desc_)                             \
     printf("    %c %5u: \"%s\" (%s)\n",                                     \
@@ -1869,32 +1867,32 @@ static void PrintUsageThenExit(int aExit
 
   BASE_PROFILER_FOR_EACH_FEATURE(PRINT_FEATURE)
 
 #  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 "
+      "  MOZ_BASE_PROFILER_STARTUP_FILTERS=<Filters>\n"
+      "  If MOZ_BASE_PROFILER_STARTUP is set, specifies the thread filters, as "
       "a\n"
       "  comma-separated list of strings. A given thread will be sampled if\n"
       "  any of the filters is a case-insensitive substring of the thread\n"
       "  name. If unset, a default is used.\n"
       "\n"
-      "  MOZ_PROFILER_SHUTDOWN\n"
+      "  MOZ_BASE_PROFILER_SHUTDOWN\n"
       "  If set, the profiler saves a profile to the named file on shutdown.\n"
       "\n"
-      "  MOZ_PROFILER_SYMBOLICATE\n"
+      "  MOZ_BASE_PROFILER_SYMBOLICATE\n"
       "  If set, the profiler will pre-symbolicate profiles.\n"
       "  *Note* This will add a significant pause when gathering data, and\n"
       "  is intended mainly for local development.\n"
       "\n"
-      "  MOZ_PROFILER_LUL_TEST\n"
+      "  MOZ_BASE_PROFILER_LUL_TEST\n"
       "  If set to any value, runs LUL unit tests at startup.\n"
       "\n"
       "  This platform %s native unwinding.\n"
       "\n",
 #  if defined(HAVE_NATIVE_UNWIND)
       "supports"
 #  else
       "does not support"
@@ -2250,18 +2248,17 @@ static uint32_t ParseFeature(const char*
       return ProfilerFeature::Name_;                \
     }
 
   BASE_PROFILER_FOR_EACH_FEATURE(PARSE_FEATURE_BIT)
 
 #  undef PARSE_FEATURE_BIT
 
   printf("\nUnrecognized feature \"%s\".\n\n", aFeature);
-  // Since we may have an old feature we don't implement anymore, don't exit
-  PrintUsageThenExit(0);
+  PrintUsageThenExit(1);
   return 0;
 }
 
 uint32_t ParseFeaturesFromStringArray(const char** aFeatures,
                                       uint32_t aFeatureCount,
                                       bool aIsStartup /* = false */) {
   uint32_t features = 0;
   for (size_t i = 0; i < aFeatureCount; i++) {
@@ -2383,112 +2380,118 @@ void profiler_init(void* aStackTop) {
     PlatformInit(lock);
 
     // (Linux-only) We could create CorePS::mLul and read unwind info into it
     // at this point. That would match the lifetime implied by destruction of
     // it in profiler_shutdown() just below. However, that gives a big delay on
     // startup, even if no profiling is actually to be done. So, instead, it is
     // created on demand at the first call to PlatformStart().
 
-    const char* startupEnv = getenv("MOZ_PROFILER_STARTUP");
+    const char* startupEnv = getenv("MOZ_BASE_PROFILER_STARTUP");
     if (!startupEnv || startupEnv[0] == '\0' ||
         ((startupEnv[0] == '0' || startupEnv[0] == 'N' ||
           startupEnv[0] == 'n') &&
          startupEnv[1] == '\0')) {
       return;
     }
 
-    LOG("- MOZ_PROFILER_STARTUP is set");
+    LOG("- MOZ_BASE_PROFILER_STARTUP is set");
 
     // Startup default capacity may be different.
     capacity = BASE_PROFILER_DEFAULT_STARTUP_ENTRIES;
 
-    const char* startupCapacity = getenv("MOZ_PROFILER_STARTUP_ENTRIES");
+    const char* startupCapacity = getenv("MOZ_BASE_PROFILER_STARTUP_ENTRIES");
     if (startupCapacity && startupCapacity[0] != '\0') {
       errno = 0;
       long capacityLong = strtol(startupCapacity, nullptr, 10);
       // `long` could be 32 or 64 bits, so we force a 64-bit comparison with
       // the maximum 32-bit signed number (as more than that is clamped down to
       // 2^31 anyway).
       if (errno == 0 && capacityLong > 0 &&
           static_cast<uint64_t>(capacityLong) <=
               static_cast<uint64_t>(INT32_MAX)) {
         capacity = PowerOfTwo32(static_cast<uint32_t>(capacityLong));
-        LOG("- MOZ_PROFILER_STARTUP_ENTRIES = %u", unsigned(capacity.Value()));
+        LOG("- MOZ_BASE_PROFILER_STARTUP_ENTRIES = %u",
+            unsigned(capacity.Value()));
       } else {
-        LOG("- MOZ_PROFILER_STARTUP_ENTRIES not a valid integer: %s",
+        LOG("- MOZ_BASE_PROFILER_STARTUP_ENTRIES not a valid integer: %s",
             startupCapacity);
         PrintUsageThenExit(1);
       }
     }
 
-    const char* startupDuration = getenv("MOZ_PROFILER_STARTUP_DURATION");
+    const char* startupDuration = getenv("MOZ_BASE_PROFILER_STARTUP_DURATION");
     if (startupDuration && startupDuration[0] != '\0') {
-      errno = 0;
-      double durationVal = strtod(startupDuration, nullptr);
-      if (errno == 0 && durationVal >= 0.0 && durationVal < HUGE_VAL) {
-        if (durationVal > 0.0) {
-          duration = Some(durationVal);
-        }
-        LOG("- MOZ_PROFILER_STARTUP_DURATION = %f", durationVal);
-      } else {
-        LOG("- MOZ_PROFILER_STARTUP_DURATION not a valid float: %s",
-            startupDuration);
-        PrintUsageThenExit(1);
-      }
+      // TODO implement if needed
+      MOZ_CRASH("MOZ_BASE_PROFILER_STARTUP_DURATION unsupported");
+      // errno = 0;
+      // double durationVal = PR_strtod(startupDuration, nullptr);
+      // if (errno == 0 && durationVal >= 0.0) {
+      //   if (durationVal > 0.0) {
+      //     duration = Some(durationVal);
+      //   }
+      //   LOG("- MOZ_BASE_PROFILER_STARTUP_DURATION = %f", durationVal);
+      // } else {
+      //   LOG("- MOZ_BASE_PROFILER_STARTUP_DURATION not a valid float: %s",
+      //       startupDuration);
+      //   PrintUsageThenExit(1);
+      // }
     }
 
-    const char* startupInterval = getenv("MOZ_PROFILER_STARTUP_INTERVAL");
+    const char* startupInterval = getenv("MOZ_BASE_PROFILER_STARTUP_INTERVAL");
     if (startupInterval && startupInterval[0] != '\0') {
-      errno = 0;
-      interval = strtod(startupInterval, nullptr);
-      if (errno == 0 && interval > 0.0 && interval <= 1000.0) {
-        LOG("- MOZ_PROFILER_STARTUP_INTERVAL = %f", interval);
-      } else {
-        LOG("- MOZ_PROFILER_STARTUP_INTERVAL not a valid float: %s",
-            startupInterval);
-        PrintUsageThenExit(1);
-      }
+      // TODO implement if needed
+      MOZ_CRASH("MOZ_BASE_PROFILER_STARTUP_INTERVAL unsupported");
+      // errno = 0;
+      // interval = PR_strtod(startupInterval, nullptr);
+      // if (errno == 0 && interval > 0.0 && interval <= 1000.0) {
+      //   LOG("- MOZ_BASE_PROFILER_STARTUP_INTERVAL = %f", interval);
+      // } else {
+      //   LOG("- MOZ_BASE_PROFILER_STARTUP_INTERVAL not a valid float: %s",
+      //       startupInterval);
+      //   PrintUsageThenExit(1);
+      // }
     }
 
     features |= StartupExtraDefaultFeatures() & AvailableFeatures();
 
     const char* startupFeaturesBitfield =
-        getenv("MOZ_PROFILER_STARTUP_FEATURES_BITFIELD");
+        getenv("MOZ_BASE_PROFILER_STARTUP_FEATURES_BITFIELD");
     if (startupFeaturesBitfield && startupFeaturesBitfield[0] != '\0') {
       errno = 0;
       features = strtol(startupFeaturesBitfield, nullptr, 10);
       if (errno == 0 && features != 0) {
-        LOG("- MOZ_PROFILER_STARTUP_FEATURES_BITFIELD = %d", features);
+        LOG("- MOZ_BASE_PROFILER_STARTUP_FEATURES_BITFIELD = %d", features);
       } else {
-        LOG("- MOZ_PROFILER_STARTUP_FEATURES_BITFIELD not a valid "
+        LOG("- MOZ_BASE_PROFILER_STARTUP_FEATURES_BITFIELD not a valid "
             "integer: "
             "%s",
             startupFeaturesBitfield);
         PrintUsageThenExit(1);
       }
     } else {
-      const char* startupFeatures = getenv("MOZ_PROFILER_STARTUP_FEATURES");
+      const char* startupFeatures =
+          getenv("MOZ_BASE_PROFILER_STARTUP_FEATURES");
       if (startupFeatures && startupFeatures[0] != '\0') {
         // Interpret startupFeatures as a list of feature strings, separated by
         // commas.
         UniquePtr<char[]> featureStringStorage;
         Vector<const char*> featureStringArray =
             SplitAtCommas(startupFeatures, featureStringStorage);
         features = ParseFeaturesFromStringArray(featureStringArray.begin(),
                                                 featureStringArray.length(),
                                                 /* aIsStartup */ true);
-        LOG("- MOZ_PROFILER_STARTUP_FEATURES = %d", features);
+        LOG("- MOZ_BASE_PROFILER_STARTUP_FEATURES = %d", features);
       }
     }
 
-    const char* startupFilters = getenv("MOZ_PROFILER_STARTUP_FILTERS");
+    const char* startupFilters = getenv("MOZ_BASE_PROFILER_STARTUP_FILTERS");
     if (startupFilters && startupFilters[0] != '\0') {
       filters = SplitAtCommas(startupFilters, filterStorage);
-      LOG("- MOZ_PROFILER_STARTUP_FILTERS = %s", startupFilters);
+      LOG("- MOZ_BASE_PROFILER_STARTUP_FILTERS = %s", startupFilters);
     }
 
     locked_profiler_start(lock, capacity, interval, features, filters.begin(),
                           filters.length(), duration);
   }
 
   // TODO: Install memory counter if it is possible from mozglue.
   // #if defined(MOZ_REPLACE_MALLOC) && defined(MOZ_PROFILER_MEMORY)
@@ -2516,17 +2519,17 @@ void profiler_shutdown() {
   // If the profiler is active we must get a handle to the SamplerThread before
   // ActivePS is destroyed, in order to delete it.
   SamplerThread* samplerThread = nullptr;
   {
     PSAutoLock lock;
 
     // Save the profile on shutdown if requested.
     if (ActivePS::Exists(lock)) {
-      const char* filename = getenv("MOZ_PROFILER_SHUTDOWN");
+      const char* filename = getenv("MOZ_BASE_PROFILER_SHUTDOWN");
       if (filename) {
         locked_profiler_save_profile_to_file(lock, filename,
                                              /* aIsShuttingDown */ true);
       }
 
       samplerThread = locked_profiler_stop(lock);
     }
 
@@ -2640,44 +2643,44 @@ void profiler_get_start_params(int* aCap
 
 void GetProfilerEnvVarsForChildProcess(
     std::function<void(const char* key, const char* value)>&& aSetEnv) {
   MOZ_RELEASE_ASSERT(CorePS::Exists());
 
   PSAutoLock lock;
 
   if (!ActivePS::Exists(lock)) {
-    aSetEnv("MOZ_PROFILER_STARTUP", "");
+    aSetEnv("MOZ_BASE_PROFILER_STARTUP", "");
     return;
   }
 
-  aSetEnv("MOZ_PROFILER_STARTUP", "1");
+  aSetEnv("MOZ_BASE_PROFILER_STARTUP", "1");
   auto capacityString =
       Smprintf("%u", unsigned(ActivePS::Capacity(lock).Value()));
-  aSetEnv("MOZ_PROFILER_STARTUP_ENTRIES", capacityString.get());
+  aSetEnv("MOZ_BASE_PROFILER_STARTUP_ENTRIES", capacityString.get());
 
   // Use AppendFloat instead of Smprintf with %f because the decimal
   // separator used by %f is locale-dependent. But the string we produce needs
   // to be parseable by strtod, which only accepts the period character as a
   // decimal separator. AppendFloat always uses the period character.
   std::string intervalString = std::to_string(ActivePS::Interval(lock));
-  aSetEnv("MOZ_PROFILER_STARTUP_INTERVAL", intervalString.c_str());
+  aSetEnv("MOZ_BASE_PROFILER_STARTUP_INTERVAL", intervalString.c_str());
 
   auto featuresString = Smprintf("%d", ActivePS::Features(lock));
-  aSetEnv("MOZ_PROFILER_STARTUP_FEATURES_BITFIELD", featuresString.get());
+  aSetEnv("MOZ_BASE_PROFILER_STARTUP_FEATURES_BITFIELD", featuresString.get());
 
   std::string filtersString;
   const Vector<std::string>& filters = ActivePS::Filters(lock);
   for (uint32_t i = 0; i < filters.length(); ++i) {
     filtersString += filters[i];
     if (i != filters.length() - 1) {
       filtersString += ",";
     }
   }
-  aSetEnv("MOZ_PROFILER_STARTUP_FILTERS", filtersString.c_str());
+  aSetEnv("MOZ_BASE_PROFILER_STARTUP_FILTERS", filtersString.c_str());
 }
 
 void profiler_received_exit_profile(const std::string& aExitProfile) {
   MOZ_RELEASE_ASSERT(CorePS::Exists());
   PSAutoLock lock;
   if (!ActivePS::Exists(lock)) {
     return;
   }
--- a/mozglue/baseprofiler/public/BaseProfiler.h
+++ b/mozglue/baseprofiler/public/BaseProfiler.h
@@ -247,18 +247,18 @@ static constexpr PowerOfTwo32 BASE_PROFI
     MakePowerOfTwo32<1u << 22>();  // 4'194'304 entries = 32MB
 #  else
     MakePowerOfTwo32<1u << 17>();  // 131'072 = 1MB
 #  endif
 
 #  define BASE_PROFILER_DEFAULT_DURATION 20
 #  define BASE_PROFILER_DEFAULT_INTERVAL 1
 
-// Initialize the profiler. If MOZ_PROFILER_STARTUP is set the profiler will
-// also be started. This call must happen before any other profiler calls
+// Initialize the profiler. If MOZ_BASE_PROFILER_STARTUP is set the profiler
+// will also be started. This call must happen before any other profiler calls
 // (except profiler_start(), which will call profiler_init() if it hasn't
 // already run).
 MFBT_API void profiler_init(void* stackTop);
 
 #  define AUTO_BASE_PROFILER_INIT \
     ::mozilla::baseprofiler::AutoProfilerInit BASE_PROFILER_RAII
 
 // Clean up the profiler module, stopping it if required. This function may
@@ -1010,17 +1010,17 @@ class MOZ_RAII AutoProfilerTracing {
  protected:
   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
   const char* mCategoryString;
   const char* mMarkerName;
   const ProfilingCategoryPair mCategoryPair;
   const Maybe<uint64_t> mInnerWindowID;
 };
 
-// Get the MOZ_PROFILER_STARTUP* environment variables that should be
+// Get the MOZ_BASE_PROFILER_STARTUP* environment variables that should be
 // supplied to a child process that is about to be launched, in order
 // to make that child process start with the same profiler settings as
 // in the current process.  The given function is invoked once for
 // each variable to be set.
 MFBT_API void GetProfilerEnvVarsForChildProcess(
     std::function<void(const char* key, const char* value)>&& aSetEnv);
 
 }  // namespace baseprofiler
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -3885,22 +3885,40 @@ void GetProfilerEnvVarsForChildProcess(
   aSetEnv("MOZ_PROFILER_STARTUP_INTERVAL", intervalString.get());
 
   auto featuresString = Smprintf("%d", ActivePS::Features(lock));
   aSetEnv("MOZ_PROFILER_STARTUP_FEATURES_BITFIELD", featuresString.get());
 
   std::string filtersString;
   const Vector<std::string>& filters = ActivePS::Filters(lock);
   for (uint32_t i = 0; i < filters.length(); ++i) {
-    if (i != 0) {
+    filtersString += filters[i];
+    if (i != filters.length() - 1) {
       filtersString += ",";
     }
-    filtersString += filters[i];
   }
   aSetEnv("MOZ_PROFILER_STARTUP_FILTERS", filtersString.c_str());
+
+#ifdef MOZ_BASE_PROFILER
+  // Blindly copy MOZ_BASE_PROFILER_STARTUP* env-vars.
+  auto copyEnv = [&](const char* aName) {
+    const char* env = getenv(aName);
+    if (!env) {
+      return;
+    }
+    aSetEnv(aName, env);
+  };
+  copyEnv("MOZ_BASE_PROFILER_STARTUP");
+  copyEnv("MOZ_BASE_PROFILER_STARTUP_ENTRIES");
+  copyEnv("MOZ_BASE_PROFILER_STARTUP_DURATION");
+  copyEnv("MOZ_BASE_PROFILER_STARTUP_INTERVAL");
+  copyEnv("MOZ_BASE_PROFILER_STARTUP_FEATURES_BITFIELD");
+  copyEnv("MOZ_BASE_PROFILER_STARTUP_FEATURES");
+  copyEnv("MOZ_BASE_PROFILER_STARTUP_FILTERS");
+#endif
 }
 
 }  // namespace mozilla
 
 void profiler_received_exit_profile(const nsCString& aExitProfile) {
   MOZ_RELEASE_ASSERT(CorePS::Exists());
   PSAutoLock lock(gPSMutex);
   if (!ActivePS::Exists(lock)) {
@@ -4059,17 +4077,17 @@ static void locked_profiler_start(PSLock
 
   MOZ_RELEASE_ASSERT(CorePS::Exists() && !ActivePS::Exists(aLock));
 
 #ifdef MOZ_BASE_PROFILER
   UniquePtr<char[]> baseprofile;
   if (baseprofiler::profiler_is_active()) {
     // Note that we still hold the lock, so the sampler cannot run yet and
     // interact negatively with the still-active BaseProfiler sampler.
-    // Assume that Base Profiler is active because of MOZ_PROFILER_STARTUP.
+    // Assume that Base Profiler is active because of MOZ_BASE_PROFILER_STARTUP.
     // Capture the Base Profiler startup profile threads (if any).
     baseprofile = baseprofiler::profiler_get_profile(
         /* aSinceTime */ 0, /* aIsShuttingDown */ false,
         /* aOnlyThreads */ true);
 
     // Now stop Base Profiler (BP), as further recording will be ignored anyway,
     // and so that it won't clash with Gecko Profiler (GP) sampling starting
     // after the lock is dropped.