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 =
|
static constexpr PowerOfTwo32 BASE_PROFILER_DEFAULT_ENTRIES =
|
||||||
# if !defined(GP_PLAT_arm_android)
|
# if !defined(GP_PLAT_arm_android)
|
||||||
MakePowerOfTwo32<1024 * 1024>(); // 1M entries = 8MB
|
MakePowerOfTwo32<8 * 1024 * 1024>(); // 8M entries = 64MB
|
||||||
# else
|
# else
|
||||||
MakePowerOfTwo32<128 * 1024>(); // 128k entries = 1MB
|
MakePowerOfTwo32<2 * 1024 * 1024>(); // 2M entries = 16MB
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
// Startup profiling usually need to capture more data, especially on slow
|
// Startup profiling usually need to capture more data, especially on slow
|
||||||
// systems.
|
// 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 =
|
static constexpr PowerOfTwo32 BASE_PROFILER_DEFAULT_STARTUP_ENTRIES =
|
||||||
# if !defined(GP_PLAT_arm_android)
|
# if !defined(GP_PLAT_arm_android)
|
||||||
MakePowerOfTwo32<4 * 1024 * 1024>(); // 4M entries = 32MB
|
mozilla::MakePowerOfTwo32<64 * 1024 * 1024>(); // 64M entries = 512MB
|
||||||
# else
|
# else
|
||||||
MakePowerOfTwo32<256 * 1024>(); // 256k entries = 2MB
|
mozilla::MakePowerOfTwo32<8 * 1024 * 1024>(); // 8M entries = 64MB
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define BASE_PROFILER_DEFAULT_DURATION 20
|
// Note: Keep in sync with GeckoThread.maybeStartGeckoProfiler:
|
||||||
# define BASE_PROFILER_DEFAULT_INTERVAL 1
|
// 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
|
// Initialize the profiler. If MOZ_PROFILER_STARTUP is set the profiler will
|
||||||
// also be started. This call must happen before any other profiler calls
|
// 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
|
#else // !MOZ_GECKO_PROFILER
|
||||||
|
|
||||||
|
# include "BaseProfiler.h"
|
||||||
# include "mozilla/Attributes.h"
|
# include "mozilla/Attributes.h"
|
||||||
# include "mozilla/Maybe.h"
|
# include "mozilla/Maybe.h"
|
||||||
# include "mozilla/MozPromise.h"
|
# include "mozilla/MozPromise.h"
|
||||||
|
|
@ -53,28 +54,14 @@ static inline void profiler_shutdown(
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static constexpr mozilla::PowerOfTwo32 PROFILER_DEFAULT_ENTRIES =
|
static constexpr mozilla::PowerOfTwo32 PROFILER_DEFAULT_ENTRIES =
|
||||||
# if !defined(GP_PLAT_arm_android)
|
mozilla::baseprofiler::BASE_PROFILER_DEFAULT_ENTRIES;
|
||||||
mozilla::MakePowerOfTwo32<8 * 1024 * 1024>(); // 8M entries = 64MB
|
|
||||||
# else
|
|
||||||
mozilla::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 mozilla::PowerOfTwo32 PROFILER_DEFAULT_STARTUP_ENTRIES =
|
static constexpr mozilla::PowerOfTwo32 PROFILER_DEFAULT_STARTUP_ENTRIES =
|
||||||
# if !defined(GP_PLAT_arm_android)
|
mozilla::baseprofiler::BASE_PROFILER_DEFAULT_STARTUP_ENTRIES;
|
||||||
mozilla::MakePowerOfTwo32<64 * 1024 * 1024>(); // 64M entries = 512MB
|
|
||||||
# else
|
# define PROFILER_DEFAULT_INTERVAL BASE_PROFILER_DEFAULT_INTERVAL
|
||||||
mozilla::MakePowerOfTwo32<8 * 1024 * 1024>(); // 8M entries = 64MB
|
# define PROFILER_MAX_INTERVAL BASE_PROFILER_MAX_INTERVAL
|
||||||
# endif
|
|
||||||
|
|
||||||
# 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
|
# define PROFILER_DEFAULT_ACTIVE_TAB_ID 0
|
||||||
|
|
||||||
// Initialize the profiler. If MOZ_PROFILER_STARTUP is set the profiler will
|
// Initialize the profiler. If MOZ_PROFILER_STARTUP is set the profiler will
|
||||||
|
|
|
||||||
|
|
@ -1659,6 +1659,7 @@ TEST(GeckoProfiler, FeaturesAndParams)
|
||||||
uint32_t features = ProfilerFeature::JS;
|
uint32_t features = ProfilerFeature::JS;
|
||||||
const char* filters[] = {"GeckoMain", "Compositor"};
|
const char* filters[] = {"GeckoMain", "Compositor"};
|
||||||
|
|
||||||
|
# define PROFILER_DEFAULT_DURATION 20 /* seconds, for tests only */
|
||||||
profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL,
|
profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL,
|
||||||
features, filters, MOZ_ARRAY_LENGTH(filters), 100,
|
features, filters, MOZ_ARRAY_LENGTH(filters), 100,
|
||||||
Some(PROFILER_DEFAULT_DURATION));
|
Some(PROFILER_DEFAULT_DURATION));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue