diff options
author | Calin Juravle <calin@google.com> | 2014-05-30 23:44:11 +0100 |
---|---|---|
committer | Calin Juravle <calin@google.com> | 2014-06-06 12:14:01 +0100 |
commit | c1b643cc6ac45dbd0eabdcd7425c7e86006c27d6 (patch) | |
tree | 250455427da979409a075a2b3197bd43ccd40fe1 /compiler/driver/compiler_driver.cc | |
parent | bb0b53f58f11c628f077603b56077dfed1a18f11 (diff) | |
download | art-c1b643cc6ac45dbd0eabdcd7425c7e86006c27d6.zip art-c1b643cc6ac45dbd0eabdcd7425c7e86006c27d6.tar.gz art-c1b643cc6ac45dbd0eabdcd7425c7e86006c27d6.tar.bz2 |
Fixed and refactored profiler options handling
- extracted profiler options in a separate class
- switched from system property reading to command line arguments
- added profile based compilation options to CompilerOptions
- removed no longer used kProfile compilation filter
- optimize dex files only if the profiler is enabled
- clean up unused arguments
Bug: 12877748
Bug: 15275634
Change-Id: I37ff68e7694370950ce8db2360562e9058ecebb7
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r-- | compiler/driver/compiler_driver.cc | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 15a086b..1cfd194 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -55,7 +55,6 @@ #include "thread_pool.h" #include "trampolines/trampoline_compiler.h" #include "transaction.h" -#include "utils.h" #include "verifier/method_verifier.h" #include "verifier/method_verifier-inl.h" @@ -331,7 +330,7 @@ CompilerDriver::CompilerDriver(const CompilerOptions* compiler_options, bool image, DescriptorSet* image_classes, size_t thread_count, bool dump_stats, bool dump_passes, CumulativeLogger* timer, std::string profile_file) - : profile_ok_(false), compiler_options_(compiler_options), + : profile_present_(false), compiler_options_(compiler_options), verification_results_(verification_results), method_inliner_map_(method_inliner_map), compiler_(Compiler::Create(this, compiler_kind)), @@ -365,11 +364,6 @@ CompilerDriver::CompilerDriver(const CompilerOptions* compiler_options, CHECK_PTHREAD_CALL(pthread_key_create, (&tls_key_, NULL), "compiler tls key"); - // Read the profile file if one is provided. - if (profile_file != "") { - profile_ok_ = profile_file_.LoadFile(profile_file); - } - dex_to_dex_compiler_ = reinterpret_cast<DexToDexCompilerFn>(ArtCompileDEX); compiler_->Init(); @@ -385,6 +379,16 @@ CompilerDriver::CompilerDriver(const CompilerOptions* compiler_options, if (compiler_options->GetGenerateGDBInformation()) { cfi_info_.reset(compiler_->GetCallFrameInformationInitialization(*this)); } + + // Read the profile file if one is provided. + if (!profile_file.empty()) { + profile_present_ = profile_file_.LoadFile(profile_file); + if (profile_present_) { + LOG(INFO) << "Using profile data form file " << profile_file; + } else { + LOG(INFO) << "Failed to load profile file " << profile_file; + } + } } std::vector<uint8_t>* CompilerDriver::DeduplicateCode(const std::vector<uint8_t>& code) { @@ -2044,7 +2048,7 @@ void CompilerDriver::InstructionSetToLLVMTarget(InstructionSet instruction_set, } bool CompilerDriver::SkipCompilation(const std::string& method_name) { - if (!profile_ok_) { + if (!profile_present_) { return false; } // First find the method in the profile file. @@ -2056,18 +2060,17 @@ bool CompilerDriver::SkipCompilation(const std::string& method_name) { } // Methods that comprise top_k_threshold % of the total samples will be compiled. - double top_k_threshold = GetDoubleProperty("dalvik.vm.profiler.compile_thr", 10.0, 90.0, 90.0); - // Compare against the start of the topK percentage bucket just in case the threshold // falls inside a bucket. - bool compile = data.GetTopKUsedPercentage() - data.GetUsedPercent() <= top_k_threshold; + bool compile = data.GetTopKUsedPercentage() - data.GetUsedPercent() + <= compiler_options_->GetTopKProfileThreshold(); if (compile) { LOG(INFO) << "compiling method " << method_name << " because its usage is part of top " << data.GetTopKUsedPercentage() << "% with a percent of " << data.GetUsedPercent() << "%" - << " (topKThreshold=" << top_k_threshold << ")"; + << " (topKThreshold=" << compiler_options_->GetTopKProfileThreshold() << ")"; } else { VLOG(compiler) << "not compiling method " << method_name << " because it's not part of leading " - << top_k_threshold << "% samples)"; + << compiler_options_->GetTopKProfileThreshold() << "% samples)"; } return !compile; } |