diff options
-rw-r--r-- | dex2oat/Android.mk | 4 | ||||
-rw-r--r-- | dex2oat/dex2oat.cc | 15 |
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 |