Bug 1551625 - Lower profiler max startup entries - r=florian
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 16 May 2019 07:40:54 +0000
changeset 474056 38b3d475e3c1592b5e27ba53f377671887d9a9d9
parent 474055 56f2b4cb0818691269e68dc1a1bb4230b7a77e03
child 474057 4a49d2484923003962d44d7a09aa057bc3f578c7
push id85629
push usergsquelart@mozilla.com
push dateThu, 16 May 2019 07:43:25 +0000
treeherderautoland@38b3d475e3c1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1551625
milestone68.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 1551625 - Lower profiler max startup entries - r=florian Now starting with a maximum of `1u << 22`, i.e. 4,194,304 entries, or 36MB per process. (Using powers of two, because that's what we round up to anyway.) Also giving more information in MOZ_PROFILER_HELP: - Reminding this is a number of entries *per process*. - Bytes per entry, and resulting total buffer sizes per process. Differential Revision: https://phabricator.services.mozilla.com/D31389
tools/profiler/core/platform.cpp
tools/profiler/public/GeckoProfiler.h
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -2212,20 +2212,22 @@ static void PrintUsageThenExit(int aExit
       "  Enables logging. The levels of logging available are\n"
       "  '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"
       "  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 in\n"
-      "  the profiler's circular buffer when the profiler is first started.\n"
+      "  If MOZ_PROFILER_STARTUP is set, specifies the number of entries per\n"
+      "  process in the profiler's circular buffer when the profiler is first\n"
+      "  started.\n"
       "  If unset, the platform default is used:\n"
-      "  %u, or %u when MOZ_PROFILER_STARTUP is set.\n"
+      "  %u entries per process, or %u when MOZ_PROFILER_STARTUP is set.\n"
+      "  (%zu bytes per entry -> %zu or %zu total bytes per process)\n"
       "\n"
       "  MOZ_PROFILER_STARTUP_DURATION=<1..>\n"
       "  If MOZ_PROFILER_STARTUP is set, specifies the maximum life time of\n"
       "  entries in the the profiler's circular buffer when the profiler is\n"
       "  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"
       "  additional time duration restriction will be applied.\n"
@@ -2244,28 +2246,30 @@ static void PrintUsageThenExit(int aExit
       "  If MOZ_PROFILER_STARTUP is set, specifies the profiling features, as\n"
       "  a comma-separated list of strings.\n"
       "  Ignored if  MOZ_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 default/unavailable)\n",
       unsigned(PROFILER_DEFAULT_ENTRIES),
-      unsigned(PROFILER_DEFAULT_STARTUP_ENTRIES));
+      unsigned(PROFILER_DEFAULT_STARTUP_ENTRIES), sizeof(ProfileBufferEntry),
+      sizeof(ProfileBufferEntry) * PROFILER_DEFAULT_ENTRIES,
+      sizeof(ProfileBufferEntry) * PROFILER_DEFAULT_STARTUP_ENTRIES);
 
 #define PRINT_FEATURE(n_, str_, Name_, desc_)                                  \
   printf("    %c %5u: \"%s\" (%s)\n", FeatureCategory(ProfilerFeature::Name_), \
          ProfilerFeature::Name_, str_, desc_);
 
   PROFILER_FOR_EACH_FEATURE(PRINT_FEATURE)
 
 #undef PRINT_FEATURE
 
   printf(
-      "    -                \"default\" (All above D+S defaults)\n"
+      "    -        \"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"
       "  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"
--- a/tools/profiler/public/GeckoProfiler.h
+++ b/tools/profiler/public/GeckoProfiler.h
@@ -234,28 +234,28 @@ bool IsThreadBeingProfiled();
 }  // namespace mozilla
 
 //---------------------------------------------------------------------------
 // Start and stop the profiler
 //---------------------------------------------------------------------------
 
 static constexpr uint32_t PROFILER_DEFAULT_ENTRIES =
 #  if !defined(ARCH_ARMV6)
-    1000000;
+    1u << 20;  // 1'048'576
 #  else
-    100000;
+    1u << 17;  // 131'072
 #  endif
 
 // Startup profiling usually need to capture more data, especially on slow
 // systems.
 static constexpr uint32_t PROFILER_DEFAULT_STARTUP_ENTRIES =
 #  if !defined(ARCH_ARMV6)
-    10000000;
+    1u << 22;  // 4'194'304
 #  else
-    100000;
+    1u << 17;  // 131'072
 #  endif
 
 #  define PROFILER_DEFAULT_DURATION 20
 #  define 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
 // (except profiler_start(), which will call profiler_init() if it hasn't