summaryrefslogtreecommitdiffstats
path: root/compiler/driver/compiler_driver.cc
diff options
context:
space:
mode:
authorCalin Juravle <calin@google.com>2014-05-23 17:33:29 +0100
committerCalin Juravle <calin@google.com>2014-06-06 11:53:28 +0100
commitbb0b53f58f11c628f077603b56077dfed1a18f11 (patch)
tree013482db95e8f2dcb7c7be85fc8f35df2c7f1361 /compiler/driver/compiler_driver.cc
parente4283be97047a26d3476acd3863dcc386498be17 (diff)
downloadart-bb0b53f58f11c628f077603b56077dfed1a18f11.zip
art-bb0b53f58f11c628f077603b56077dfed1a18f11.tar.gz
art-bb0b53f58f11c628f077603b56077dfed1a18f11.tar.bz2
Clean up the sampling profiler
- rename variables/fields names to match the code style (use _underscore_names_) - extract common property parsing in utils.cc - fail to load profile file if any line is malformed - added ProfileFile to manage the profile data generate in the previous runs (replaces ProfileHelper and nests ProfileData) Bug: 12877748 Change-Id: Ie7bda30bfdeb7e78534c986615b0649eac12a97b
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r--compiler/driver/compiler_driver.cc37
1 files changed, 13 insertions, 24 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 8d4e283..15a086b 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -35,6 +35,7 @@
#include "driver/compiler_options.h"
#include "jni_internal.h"
#include "object_utils.h"
+#include "profiler.h"
#include "runtime.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/accounting/heap_bitmap.h"
@@ -54,13 +55,10 @@
#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"
-#ifdef HAVE_ANDROID_OS
-#include "cutils/properties.h"
-#endif
-
namespace art {
static double Percentage(size_t x, size_t y) {
@@ -369,7 +367,7 @@ CompilerDriver::CompilerDriver(const CompilerOptions* compiler_options,
// Read the profile file if one is provided.
if (profile_file != "") {
- profile_ok_ = ProfileHelper::LoadProfileMap(profile_map_, profile_file);
+ profile_ok_ = profile_file_.LoadFile(profile_file);
}
dex_to_dex_compiler_ = reinterpret_cast<DexToDexCompilerFn>(ArtCompileDEX);
@@ -2049,36 +2047,27 @@ bool CompilerDriver::SkipCompilation(const std::string& method_name) {
if (!profile_ok_) {
return false;
}
- // Methods that comprise topKPercentThreshold % of the total samples will be compiled.
- double topKPercentThreshold = 90.0;
-#ifdef HAVE_ANDROID_OS
- char buf[PROP_VALUE_MAX];
- property_get("dalvik.vm.profile.compile_thr", buf, "90.0");
- topKPercentThreshold = strtod(buf, nullptr);
-#endif
- // Test for reasonable thresholds.
- if (topKPercentThreshold < 10.0 || topKPercentThreshold > 90.0) {
- topKPercentThreshold = 90.0;
- }
-
- // First find the method in the profile map.
- ProfileMap::iterator i = profile_map_.find(method_name);
- if (i == profile_map_.end()) {
+ // First find the method in the profile file.
+ ProfileFile::ProfileData data;
+ if (!profile_file_.GetProfileData(&data, method_name)) {
// Not in profile, no information can be determined.
VLOG(compiler) << "not compiling " << method_name << " because it's not in the profile";
return true;
}
- const ProfileData& data = i->second;
+
+ // 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() <= topKPercentThreshold;
+ bool compile = data.GetTopKUsedPercentage() - data.GetUsedPercent() <= top_k_threshold;
if (compile) {
LOG(INFO) << "compiling method " << method_name << " because its usage is part of top "
- << data.GetTopKUsedPercentage() << "% with a percent of " << data.GetUsedPercent() << "%";
+ << data.GetTopKUsedPercentage() << "% with a percent of " << data.GetUsedPercent() << "%"
+ << " (topKThreshold=" << top_k_threshold << ")";
} else {
VLOG(compiler) << "not compiling method " << method_name << " because it's not part of leading "
- << topKPercentThreshold << "% samples)";
+ << top_k_threshold << "% samples)";
}
return !compile;
}