Bug 1340928 (part 9) - Remove MOZ_PROFILER_STACK_SCAN env var. r=mstange.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 21 Feb 2017 13:53:19 +1100
changeset 373481 b6b681adb0173c3d41faec2e7ff1cea163b6fdb6
parent 373480 8ac2f3a144257a917ac118499f54c6e18862bd21
child 373482 aa7e56055a3ec7b7b4bec6a5a1bc9265e0cb4a4d
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1340928
milestone54.0a1
Bug 1340928 (part 9) - Remove MOZ_PROFILER_STACK_SCAN env var. r=mstange. It's used to set gUnwindStackScan, which is never used.
tools/profiler/core/platform-linux-android.cpp
tools/profiler/core/platform.cpp
--- a/tools/profiler/core/platform-linux-android.cpp
+++ b/tools/profiler/core/platform-linux-android.cpp
@@ -473,18 +473,16 @@ static void ReadProfilerVars(const char*
     while (fgets(line, bufferSize, file) != NULL) {
       feature = strtok_r(line, "=", &savePtr);
       value = strtok_r(NULL, "", &savePtr);
 
       if (strncmp(feature, PROFILER_INTERVAL, bufferSize) == 0) {
         set_profiler_interval(value);
       } else if (strncmp(feature, PROFILER_ENTRIES, bufferSize) == 0) {
         set_profiler_entries(value);
-      } else if (strncmp(feature, PROFILER_STACK, bufferSize) == 0) {
-        set_profiler_scan(value);
       } else if (strncmp(feature, PROFILER_FEATURES, bufferSize) == 0) {
         *featureCount = readCSVArray(value, features);
       } else if (strncmp(feature, "threads", bufferSize) == 0) {
         *threadCount = readCSVArray(value, threadNames);
       }
     }
 
     fclose(file);
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -169,17 +169,16 @@ static Atomic<bool> gUseStackWalk(false)
 
 /* we don't need to worry about overflow because we only treat the
  * case of them being the same as special. i.e. we only run into
  * a problem if 2^32 events happen between samples that we need
  * to know are associated with different events */
 
 // Values harvested from env vars, that control the profiler.
 static int gUnwindInterval;   /* in milliseconds */
-static int gUnwindStackScan;  /* max # of dubious frames allowed */
 static int gProfileEntries;   /* how many entries do we store? */
 
 static mozilla::StaticAutoPtr<mozilla::ProfilerIOInterposeObserver>
                                                             gInterposeObserver;
 
 // The name that identifies the gecko thread for calls to
 // profiler_register_thread.
 static const char* gGeckoThreadName = "GeckoMain";
@@ -1304,46 +1303,29 @@ set_profiler_entries(const char* aEntrie
     }
     return false;
   }
 
   return true;
 }
 
 static bool
-set_profiler_scan(const char* aScanCount)
-{
-  if (aScanCount) {
-    errno = 0;
-    long int n = strtol(aScanCount, nullptr, 10);
-    if (errno == 0 && 0 <= n && n <= 100) {
-      gUnwindStackScan = n;
-      return true;
-    }
-    return false;
-  }
-
-  return true;
-}
-
-static bool
 is_native_unwinding_avail()
 {
 # if defined(HAVE_NATIVE_UNWIND)
   return true;
 #else
   return false;
 #endif
 }
 
 // Environment variables to control the profiler
 static const char* PROFILER_HELP     = "MOZ_PROFILER_HELP";
 static const char* PROFILER_INTERVAL = "MOZ_PROFILER_INTERVAL";
 static const char* PROFILER_ENTRIES  = "MOZ_PROFILER_ENTRIES";
-static const char* PROFILER_STACK    = "MOZ_PROFILER_STACK_SCAN";
 #if defined(GP_OS_android)
 static const char* PROFILER_FEATURES = "MOZ_PROFILING_FEATURES";
 #endif
 
 static void
 profiler_usage()
 {
   LOG( "Profiler: ");
@@ -1356,76 +1338,66 @@ profiler_usage()
   LOG( "Profiler:   If unset, platform default is used.");
   LOG( "Profiler: ");
   LOG( "Profiler:   MOZ_PROFILER_ENTRIES=<number>    (count, minimum of 1)");
   LOG( "Profiler:   If unset, platform default is used.");
   LOG( "Profiler: ");
   LOG( "Profiler:   MOZ_PROFILER_VERBOSE");
   LOG( "Profiler:   If set to any value, increases verbosity (recommended).");
   LOG( "Profiler: ");
-  LOG( "Profiler:   MOZ_PROFILER_STACK_SCAN=<number>   (default is zero)");
-  LOG( "Profiler:   The number of dubious (stack-scanned) frames allowed");
-  LOG( "Profiler: ");
   LOG( "Profiler:   MOZ_PROFILER_LUL_TEST");
   LOG( "Profiler:   If set to any value, runs LUL unit tests at startup of");
   LOG( "Profiler:   the unwinder thread, and prints a short summary of results.");
   LOG( "Profiler: ");
   LOGF("Profiler:   This platform %s native unwinding.",
        is_native_unwinding_avail() ? "supports" : "does not support");
   LOG( "Profiler: ");
 
   /* Re-set defaults */
   gUnwindInterval   = 0;  /* We'll have to look elsewhere */
   gProfileEntries   = 0;
-  gUnwindStackScan  = 0;
 
   LOG( "Profiler:");
   LOGF("Profiler: Sampling interval = %d ms (zero means \"platform default\")",
        (int)gUnwindInterval);
   LOGF("Profiler: Entry store size  = %d (zero means \"platform default\")",
        (int)gProfileEntries);
-  LOGF("Profiler: UnwindStackScan   = %d (max dubious frames per unwind).",
-       (int)gUnwindStackScan);
   LOG( "Profiler:");
 }
 
 // Read env vars at startup, so as to set:
-//   gUnwindInterval, gProfileEntries, gUnwindStackScan.
+//   gUnwindInterval, gProfileEntries
 static void
 read_profiler_env_vars()
 {
   /* Set defaults */
   gUnwindInterval = 0;  /* We'll have to look elsewhere */
   gProfileEntries = 0;
 
   const char* interval = getenv(PROFILER_INTERVAL);
   const char* entries = getenv(PROFILER_ENTRIES);
-  const char* scanCount = getenv(PROFILER_STACK);
 
   if (getenv(PROFILER_HELP)) {
     // Enable verbose output
     profiler_set_verbosity(Verbosity::VERBOSE);
     profiler_usage();
     // Now force the next enquiry of profiler_verbose to re-query
     // env var MOZ_PROFILER_VERBOSE.
     profiler_set_verbosity(Verbosity::UNCHECKED);
   }
 
   if (!set_profiler_interval(interval) ||
-      !set_profiler_entries(entries) ||
-      !set_profiler_scan(scanCount)) {
+      !set_profiler_entries(entries)) {
       profiler_usage();
   } else {
     LOG( "Profiler:");
     LOGF("Profiler: Sampling interval = %d ms (zero means \"platform default\")",
         (int)gUnwindInterval);
     LOGF("Profiler: Entry store size  = %d (zero means \"platform default\")",
         (int)gProfileEntries);
-    LOGF("Profiler: UnwindStackScan   = %d (max dubious frames per unwind).",
-        (int)gUnwindStackScan);
     LOG( "Profiler:");
   }
 }
 
 static bool
 is_main_thread_name(const char* aName)
 {
   return aName && (strcmp(aName, gGeckoThreadName) == 0);
@@ -1635,18 +1607,17 @@ profiler_init(void* stackTop)
   // created on demand at the first call to PlatformStart().
 
   PseudoStack* stack = new PseudoStack();
   tlsPseudoStack.set(stack);
 
   bool isMainThread = true;
   RegisterCurrentThread(gGeckoThreadName, stack, isMainThread, stackTop);
 
-  // Read interval settings from MOZ_PROFILER_INTERVAL and stack-scan
-  // threshhold from MOZ_PROFILER_STACK_SCAN.
+  // Read settings from environment variables.
   read_profiler_env_vars();
 
   // Platform-specific initialization.
   PlatformInit();
 
   set_stderr_callback(profiler_log);
 
 #if defined(PROFILE_JAVA)