diff options
| author | 2017-06-09 23:21:03 +0000 | |
|---|---|---|
| committer | 2017-06-09 23:21:05 +0000 | |
| commit | f052aa7268f656f97099185ac6b51eeacd78a97d (patch) | |
| tree | 4c9512a31413af619e6d192672d141d5acc0de23 | |
| parent | 4e44dcc82997cd0471946bceabd5a8477bfff118 (diff) | |
| parent | 273d11009876bca38065ace9a7743c7eceacbcce (diff) | |
Merge "Update startup compilation thresholds"
| -rw-r--r-- | runtime/jit/profile_saver.cc | 3 | ||||
| -rw-r--r-- | runtime/jit/profile_saver_options.h | 14 |
2 files changed, 13 insertions, 4 deletions
diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc index 68f33bde03..edce9cd96c 100644 --- a/runtime/jit/profile_saver.cc +++ b/runtime/jit/profile_saver.cc @@ -251,7 +251,8 @@ void ProfileSaver::FetchAndCacheResolvedClassesAndMethods() { MethodReferenceCollection hot_methods(allocator.Adapter(), allocator.Adapter()); MethodReferenceCollection startup_methods(allocator.Adapter(), allocator.Adapter()); TypeReferenceCollection resolved_classes(allocator.Adapter(), allocator.Adapter()); - const size_t hot_threshold = options_.GetHotStartupMethodSamples(); + const bool is_low_ram = Runtime::Current()->GetHeap()->IsLowMemoryMode(); + const size_t hot_threshold = options_.GetHotStartupMethodSamples(is_low_ram); { ScopedObjectAccess soa(self); gc::ScopedGCCriticalSection sgcs(self, diff --git a/runtime/jit/profile_saver_options.h b/runtime/jit/profile_saver_options.h index 455bc1aae4..44550f4ddb 100644 --- a/runtime/jit/profile_saver_options.h +++ b/runtime/jit/profile_saver_options.h @@ -24,16 +24,18 @@ struct ProfileSaverOptions { static constexpr uint32_t kSaveResolvedClassesDelayMs = 5 * 1000; // 5 seconds // Minimum number of JIT samples during launch to mark a method as hot in the profile. static constexpr uint32_t kHotStartupMethodSamples = 1; + static constexpr uint32_t kHotStartupMethodSamplesLowRam = 256; static constexpr uint32_t kMinMethodsToSave = 10; static constexpr uint32_t kMinClassesToSave = 10; static constexpr uint32_t kMinNotificationBeforeWake = 10; static constexpr uint32_t kMaxNotificationBeforeWake = 50; + static constexpr uint32_t kHotStartupMethodSamplesNotSet = std::numeric_limits<uint32_t>::max(); ProfileSaverOptions() : enabled_(false), min_save_period_ms_(kMinSavePeriodMs), save_resolved_classes_delay_ms_(kSaveResolvedClassesDelayMs), - hot_startup_method_samples_(kHotStartupMethodSamples), + hot_startup_method_samples_(kHotStartupMethodSamplesNotSet), min_methods_to_save_(kMinMethodsToSave), min_classes_to_save_(kMinClassesToSave), min_notification_before_wake_(kMinNotificationBeforeWake), @@ -73,8 +75,12 @@ struct ProfileSaverOptions { uint32_t GetSaveResolvedClassesDelayMs() const { return save_resolved_classes_delay_ms_; } - uint32_t GetHotStartupMethodSamples() const { - return hot_startup_method_samples_; + uint32_t GetHotStartupMethodSamples(bool is_low_ram) const { + uint32_t ret = hot_startup_method_samples_; + if (ret == kHotStartupMethodSamplesNotSet) { + ret = is_low_ram ? kHotStartupMethodSamplesLowRam : kHotStartupMethodSamples; + } + return ret; } uint32_t GetMinMethodsToSave() const { return min_methods_to_save_; @@ -107,6 +113,8 @@ struct ProfileSaverOptions { bool enabled_; uint32_t min_save_period_ms_; uint32_t save_resolved_classes_delay_ms_; + // Do not access hot_startup_method_samples_ directly for reading since it may be set to the + // placeholder default. uint32_t hot_startup_method_samples_; uint32_t min_methods_to_save_; uint32_t min_classes_to_save_; |