summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2017-06-06 17:07:13 -0700
committer Mathieu Chartier <mathieuc@google.com> 2017-06-09 14:28:51 -0700
commit273d11009876bca38065ace9a7743c7eceacbcce (patch)
treea2fedab1f90d9d605797d4050e40c6cda5e6d379
parent29365184fe2e4f3d32f56b32edec8d03852b9556 (diff)
Update startup compilation thresholds
This change aims to compile less startup methods to save RAM and reduce code size. Numbers are from shortly after launching the apps. Leave cutoff as 1 for high end devices for now. We may want to revisit that later. For low ram devices, the cutoff is 256. This regresses startup time by 1% but saves more RAM. Results: (odex+vdex) PSS: -25% average odex size: -42% average vdex size unchanged Apps: Gmail, Maps, YouTube, Search Spreadsheet at go/compilethreshold Bug: 36457259 Test: test-art-host Change-Id: I49d157df9379532d8d7a1ea1d844bb4beb195bb2
-rw-r--r--runtime/jit/profile_saver.cc3
-rw-r--r--runtime/jit/profile_saver_options.h14
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_;