summaryrefslogtreecommitdiffstats
path: root/dex2oat
diff options
context:
space:
mode:
authorChitti Babu Theegala <ctheegal@codeaurora.org>2015-08-06 19:52:05 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:20:37 -0600
commitc06972f666147061f88aeef265465cb88a27f3b2 (patch)
tree635ac51b6aa69abf1a485b266d374ca32fcd5f1b /dex2oat
parent048801b194a1664f1fc1dd55338f44e92c283138 (diff)
downloadart-c06972f666147061f88aeef265465cb88a27f3b2.zip
art-c06972f666147061f88aeef265465cb88a27f3b2.tar.gz
art-c06972f666147061f88aeef265465cb88a27f3b2.tar.bz2
ART: Tuning compiler thread count for application runtime
dex2oat decides the number of compiler threads to be spawned based on the number of cores in the system. Using this max possible compiler threads causes over parallelization on some platforms and there by leads to longer install times. Reducing to fewer threads on these platforms, improves this time by 60% to 100%. Some APPs will call dex2oat at the first launch time(runtime). The thread count tuning is needed for such scenario. Change-Id: Id3a545f0300f93397627beeb697a7b7cfd912d52
Diffstat (limited to 'dex2oat')
-rw-r--r--dex2oat/Android.mk4
-rw-r--r--dex2oat/dex2oat.cc15
2 files changed, 19 insertions, 0 deletions
diff --git a/dex2oat/Android.mk b/dex2oat/Android.mk
index 321cd75..3783c2b 100644
--- a/dex2oat/Android.mk
+++ b/dex2oat/Android.mk
@@ -21,6 +21,10 @@ include art/build/Android.executable.mk
DEX2OAT_SRC_FILES := \
dex2oat.cc
+ifeq ($$(art_target_or_host),target)
+LOCAL_SHARED_LIBRARIES += libcutils
+endif
+
# TODO: Remove this when the framework (installd) supports pushing the
# right instruction-set parameter for the primary architecture.
ifneq ($(filter ro.zygote=zygote64,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES)),)
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index e913c20..d466a9b 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -75,6 +75,9 @@
#include "vector_output_stream.h"
#include "well_known_classes.h"
#include "zip_archive.h"
+#ifdef HAVE_ANDROID_OS
+#include "cutils/properties.h"
+#endif
namespace art {
@@ -841,6 +844,18 @@ class Dex2Oat FINAL {
}
}
+ // Override the number of compiler threads with optimal value (thru system property)
+ #ifdef HAVE_ANDROID_OS
+ const char* propertyName = "ro.sys.fw.dex2oat_thread_count";
+ char thread_count_str[PROPERTY_VALUE_MAX];
+
+ if (property_get(propertyName, thread_count_str, "") > 0) {
+ if (ParseUint(thread_count_str, &thread_count_)) {
+ LOG(INFO) << "Adjusted thread count (for runtime dex2oat): " << thread_count_ << ", " << thread_count_str;
+ }
+ }
+ #endif
+
image_ = (!image_filename_.empty());
if (!requested_specific_compiler && !kUseOptimizingCompiler) {
// If no specific compiler is requested, the current behavior is