forked from mirrors/gecko-dev
Bug 1777431 - Use the same default constants in both profilers - r=florian
The BASE_PROFILER_DEFAULT_...ENTRIES constants in BaseProfiler.h were smaller than those in ProfilerControl.h, leading to a shorter profiling range in the parent process! Now these constants and some other shared ones are only defined in BaseProfiler.h, and reused in ProfilerControl.h. PROFILER_DEFAULT_DURATION was moved to where it's first used, and should one day disappear (see bug 1632365). Differential Revision: https://phabricator.services.mozilla.com/D153669
This commit is contained in:
parent
9ed83283ae
commit
f91d94a4c9
3 changed files with 17 additions and 25 deletions
|
|
@ -117,22 +117,26 @@ class SpliceableJSONWriter;
|
|||
|
||||
static constexpr PowerOfTwo32 BASE_PROFILER_DEFAULT_ENTRIES =
|
||||
# if !defined(GP_PLAT_arm_android)
|
||||
MakePowerOfTwo32<1024 * 1024>(); // 1M entries = 8MB
|
||||
MakePowerOfTwo32<8 * 1024 * 1024>(); // 8M entries = 64MB
|
||||
# else
|
||||
MakePowerOfTwo32<128 * 1024>(); // 128k entries = 1MB
|
||||
MakePowerOfTwo32<2 * 1024 * 1024>(); // 2M entries = 16MB
|
||||
# endif
|
||||
|
||||
// Startup profiling usually need to capture more data, especially on slow
|
||||
// systems.
|
||||
// Note: Keep in sync with GeckoThread.maybeStartGeckoProfiler:
|
||||
// https://searchfox.org/mozilla-central/source/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoThread.java
|
||||
static constexpr PowerOfTwo32 BASE_PROFILER_DEFAULT_STARTUP_ENTRIES =
|
||||
# if !defined(GP_PLAT_arm_android)
|
||||
MakePowerOfTwo32<4 * 1024 * 1024>(); // 4M entries = 32MB
|
||||
mozilla::MakePowerOfTwo32<64 * 1024 * 1024>(); // 64M entries = 512MB
|
||||
# else
|
||||
MakePowerOfTwo32<256 * 1024>(); // 256k entries = 2MB
|
||||
mozilla::MakePowerOfTwo32<8 * 1024 * 1024>(); // 8M entries = 64MB
|
||||
# endif
|
||||
|
||||
# define BASE_PROFILER_DEFAULT_DURATION 20
|
||||
# define BASE_PROFILER_DEFAULT_INTERVAL 1
|
||||
// Note: Keep in sync with GeckoThread.maybeStartGeckoProfiler:
|
||||
// https://searchfox.org/mozilla-central/source/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoThread.java
|
||||
# define BASE_PROFILER_DEFAULT_INTERVAL 1 /* millisecond */
|
||||
# define BASE_PROFILER_MAX_INTERVAL 5000 /* milliseconds */
|
||||
|
||||
// Initialize the profiler. If MOZ_PROFILER_STARTUP is set the profiler will
|
||||
// also be started. This call must happen before any other profiler calls
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ static inline void profiler_shutdown(
|
|||
|
||||
#else // !MOZ_GECKO_PROFILER
|
||||
|
||||
# include "BaseProfiler.h"
|
||||
# include "mozilla/Attributes.h"
|
||||
# include "mozilla/Maybe.h"
|
||||
# include "mozilla/MozPromise.h"
|
||||
|
|
@ -53,28 +54,14 @@ static inline void profiler_shutdown(
|
|||
//---------------------------------------------------------------------------
|
||||
|
||||
static constexpr mozilla::PowerOfTwo32 PROFILER_DEFAULT_ENTRIES =
|
||||
# if !defined(GP_PLAT_arm_android)
|
||||
mozilla::MakePowerOfTwo32<8 * 1024 * 1024>(); // 8M entries = 64MB
|
||||
# else
|
||||
mozilla::MakePowerOfTwo32<2 * 1024 * 1024>(); // 2M entries = 16MB
|
||||
# endif
|
||||
mozilla::baseprofiler::BASE_PROFILER_DEFAULT_ENTRIES;
|
||||
|
||||
// Startup profiling usually need to capture more data, especially on slow
|
||||
// systems.
|
||||
// Note: Keep in sync with GeckoThread.maybeStartGeckoProfiler:
|
||||
// https://searchfox.org/mozilla-central/source/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoThread.java
|
||||
static constexpr mozilla::PowerOfTwo32 PROFILER_DEFAULT_STARTUP_ENTRIES =
|
||||
# if !defined(GP_PLAT_arm_android)
|
||||
mozilla::MakePowerOfTwo32<64 * 1024 * 1024>(); // 64M entries = 512MB
|
||||
# else
|
||||
mozilla::MakePowerOfTwo32<8 * 1024 * 1024>(); // 8M entries = 64MB
|
||||
# endif
|
||||
mozilla::baseprofiler::BASE_PROFILER_DEFAULT_STARTUP_ENTRIES;
|
||||
|
||||
# define PROFILER_DEFAULT_INTERVAL BASE_PROFILER_DEFAULT_INTERVAL
|
||||
# define PROFILER_MAX_INTERVAL BASE_PROFILER_MAX_INTERVAL
|
||||
|
||||
# define PROFILER_DEFAULT_DURATION 20 /* seconds, for tests only */
|
||||
// Note: Keep in sync with GeckoThread.maybeStartGeckoProfiler:
|
||||
// https://searchfox.org/mozilla-central/source/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoThread.java
|
||||
# define PROFILER_DEFAULT_INTERVAL 1 /* millisecond */
|
||||
# define PROFILER_MAX_INTERVAL 5000 /* milliseconds */
|
||||
# define PROFILER_DEFAULT_ACTIVE_TAB_ID 0
|
||||
|
||||
// Initialize the profiler. If MOZ_PROFILER_STARTUP is set the profiler will
|
||||
|
|
|
|||
|
|
@ -1659,6 +1659,7 @@ TEST(GeckoProfiler, FeaturesAndParams)
|
|||
uint32_t features = ProfilerFeature::JS;
|
||||
const char* filters[] = {"GeckoMain", "Compositor"};
|
||||
|
||||
# define PROFILER_DEFAULT_DURATION 20 /* seconds, for tests only */
|
||||
profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL,
|
||||
features, filters, MOZ_ARRAY_LENGTH(filters), 100,
|
||||
Some(PROFILER_DEFAULT_DURATION));
|
||||
|
|
|
|||
Loading…
Reference in a new issue