From 1ca50b882dc468d6a98af95e0cfaeb0fe0b3daac Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 26 Oct 2021 17:55:44 -0700 Subject: [PATCH] Set default profiling rate on iOS 32 bit devices to 500Hz (flutter/engine#29347) * Set default profiling rate on iOS 32 bit devices to 500Hz The current default profiling rate is 1000Hz in the VM. Fixes https://github.com/flutter/flutter/issues/92421. * Address comments --- engine/src/flutter/runtime/dart_vm.cc | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/engine/src/flutter/runtime/dart_vm.cc b/engine/src/flutter/runtime/dart_vm.cc index a2f400bb81..de3b94a89c 100644 --- a/engine/src/flutter/runtime/dart_vm.cc +++ b/engine/src/flutter/runtime/dart_vm.cc @@ -215,11 +215,25 @@ static std::vector ProfilingFlags(bool enable_profiling) { // the VM enables the same by default. In either case, we have some profiling // flags. if (enable_profiling) { - return {// This is the default. But just be explicit. - "--profiler", - // This instructs the profiler to walk C++ frames, and to include - // them in the profile. - "--profile-vm"}; + return { + // This is the default. But just be explicit. + "--profiler", + // This instructs the profiler to walk C++ frames, and to include + // them in the profile. + "--profile-vm", +#if OS_IOS && ARCH_CPU_ARM_FAMILY && ARCH_CPU_ARMEL + // Set the profiler interrupt period to 500Hz instead of the + // default 1000Hz on 32-bit iOS devices to reduce average and worst + // case frame build times. + // + // Note: profile_period is time in microseconds between sampling + // events, not frequency. Frequency is calculated 1/period (or + // 1,000,000 / 2,000 -> 500Hz in this case). + "--profile_period=2000", +#else + "--profile_period=1000", +#endif // OS_IOS && ARCH_CPU_ARM_FAMILY && ARCH_CPU_ARMEL + }; } else { return {"--no-profiler"}; }