Bug 960153 - Add env var MOZ_PROFILER_STARTUP_FEATURES that lets you select which features should be active for startup profiling. r=njn
authorMarkus Stange <mstange@themasta.com>
Thu, 20 Jul 2017 20:43:19 -0400
changeset 419610 4b4ef581b92af1407bbe277ce15c7e6413b74898
parent 419609 4ef452538efdb141b7050e877b7115317f306d73
child 419611 56d76dbf3e1171fb726f5beab806c523192f48b9
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs960153
milestone56.0a1
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
Bug 960153 - Add env var MOZ_PROFILER_STARTUP_FEATURES that lets you select which features should be active for startup profiling. r=njn MozReview-Commit-ID: 9RzHNgIVcSb
tools/profiler/core/platform.cpp
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -1632,16 +1632,21 @@ PrintUsageThenExit(int aExitCode)
     "  the profiler's circular buffer when the profiler is first started.\n"
     "  If unset, the platform default is used.\n"
     "\n"
     "  MOZ_PROFILER_STARTUP_INTERVAL=<1..1000>\n"
     "  If MOZ_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=<Features>\n"
+    "  If MOZ_PROFILER_STARTUP is set, specifies the profiling features, as a\n"
+    "  comma-separated list of strings.\n"
+    "  If unset, the platform default is used.\n"
+    "\n"
     "  MOZ_PROFILER_STARTUP_FILTERS=<Filters>\n"
     "  If MOZ_PROFILER_STARTUP is set, specifies the thread filters, as a\n"
     "  comma-separated list of strings. A given thread will be sampled if any\n"
     "  of the filters is a case-insensitive substring of the thread name.\n"
     "  If unset, a default is used.\n"
     "\n"
     "  MOZ_PROFILER_SHUTDOWN\n"
     "  If set, the profiler saves a profile to the named file on shutdown.\n"
@@ -2208,16 +2213,26 @@ profiler_init(void* aStackTop)
       interval = PR_strtod(startupInterval, nullptr);
       if (errno == 0 && interval > 0.0 && interval <= 1000.0) {
         LOG("- MOZ_PROFILER_STARTUP_INTERVAL = %f", interval);
       } else {
         PrintUsageThenExit(1);
       }
     }
 
+    const char* startupFeatures = getenv("MOZ_PROFILER_STARTUP_FEATURES");
+    if (startupFeatures) {
+      UniquePtr<char[]> featureStringStorage;
+      nsTArray<const char*> featureStringArray =
+        SplitAtCommas(startupFeatures, featureStringStorage);
+      features = ParseFeaturesFromStringArray(featureStringArray.Elements(),
+                                              featureStringArray.Length());
+      LOG("- MOZ_PROFILER_STARTUP_FEATURES = %d", features);
+    }
+
     const char* startupFilters = getenv("MOZ_PROFILER_STARTUP_FILTERS");
     if (startupFilters) {
       filters = SplitAtCommas(startupFilters, filterStorage);
       LOG("- MOZ_PROFILER_STARTUP_FILTERS = %s", startupFilters);
     }
 
     locked_profiler_start(lock, entries, interval, features,
                           filters.Elements(), filters.Length());