Make non-debug dex2oat omit timing and stats information
This is to try and avoid logcat rollovers during startup in stability monkey runs
Change-Id: I32a84517fdb97829d7efa3067cb99e2f38b049ae
diff --git a/src/common_test.h b/src/common_test.h
index ea5e96b..07f53a0 100644
--- a/src/common_test.h
+++ b/src/common_test.h
@@ -355,7 +355,8 @@
}
}
class_linker_->FixupDexCaches(runtime_->GetResolutionMethod());
- compiler_.reset(new Compiler(instruction_set, true, 2, false, new std::set<std::string>));
+ compiler_.reset(new Compiler(instruction_set, true, 2, false, new std::set<std::string>,
+ true, true));
#if defined(ART_USE_LLVM_COMPILER)
compiler_->SetElfFileName("gtest");
#endif
diff --git a/src/compiler.cc b/src/compiler.cc
index 7d71278..4d39cd7 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -309,7 +309,8 @@
}
Compiler::Compiler(InstructionSet instruction_set, bool image, size_t thread_count,
- bool support_debugging, const std::set<std::string>* image_classes)
+ bool support_debugging, const std::set<std::string>* image_classes,
+ bool dump_stats, bool dump_timings)
: instruction_set_(instruction_set),
compiled_classes_lock_("compiled classes lock"),
compiled_methods_lock_("compiled method lock"),
@@ -318,6 +319,8 @@
thread_count_(thread_count),
support_debugging_(support_debugging),
stats_(new AOTCompilationStats),
+ dump_stats_(dump_stats),
+ dump_timings_(dump_timings),
image_classes_(image_classes),
compiler_library_(NULL),
compiler_(NULL),
@@ -423,11 +426,13 @@
PostCompile(class_loader, dex_files);
timings.AddSplit("PostCompile");
- if (timings.GetTotalNs() > MsToNs(1000)) {
+ if (dump_timings_ && timings.GetTotalNs() > MsToNs(1000)) {
timings.Dump();
}
- stats_->Dump();
+ if (dump_stats_) {
+ stats_->Dump();
+ }
}
void Compiler::CompileOne(const Method* method) {
diff --git a/src/compiler.h b/src/compiler.h
index 711ee71..2085f43 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -45,7 +45,8 @@
// can assume will be in the image, with NULL implying all available
// classes.
explicit Compiler(InstructionSet instruction_set, bool image, size_t thread_count,
- bool support_debugging, const std::set<std::string>* image_classes);
+ bool support_debugging, const std::set<std::string>* image_classes,
+ bool dump_stats, bool dump_timings);
~Compiler();
@@ -277,6 +278,9 @@
UniquePtr<AOTCompilationStats> stats_;
+ bool dump_stats_;
+ bool dump_timings_;
+
const std::set<std::string>* image_classes_;
#if defined(ART_USE_LLVM_COMPILER)
diff --git a/src/dex2oat.cc b/src/dex2oat.cc
index 794c6d2..0098f02 100644
--- a/src/dex2oat.cc
+++ b/src/dex2oat.cc
@@ -207,7 +207,9 @@
std::string const& bitcode_filename,
#endif
bool image,
- const std::set<std::string>* image_classes) {
+ const std::set<std::string>* image_classes,
+ bool dump_stats,
+ bool dump_timings) {
// SirtRef and ClassLoader creation needs to come after Runtime::Create
UniquePtr<SirtRef<ClassLoader> > class_loader(new SirtRef<ClassLoader>(NULL));
if (class_loader.get() == NULL) {
@@ -229,7 +231,9 @@
image,
thread_count_,
support_debugging_,
- image_classes));
+ image_classes,
+ dump_stats,
+ dump_timings));
#if defined(ART_USE_LLVM_COMPILER)
compiler->SetElfFileName(elf_filename);
@@ -473,6 +477,13 @@
int thread_count = 2;
bool support_debugging = false;
InstructionSet instruction_set = kThumb2;
+#ifndef NDEBUG
+ bool dump_stats = true;
+ bool dump_timings = true;
+#else
+ bool dump_stats = false;
+ bool dump_timings = false;
+#endif
for (int i = 0; i < argc; i++) {
const StringPiece option(argv[i]);
@@ -718,7 +729,9 @@
bitcode_filename,
#endif
image,
- image_classes.get()));
+ image_classes.get(),
+ dump_stats,
+ dump_timings));
if (compiler.get() == NULL) {
LOG(ERROR) << "Failed to create oat file: " << oat_location;
diff --git a/src/oat_test.cc b/src/oat_test.cc
index 3cbd3ed..d9d70ea 100644
--- a/src/oat_test.cc
+++ b/src/oat_test.cc
@@ -29,7 +29,7 @@
SirtRef<ClassLoader> class_loader(NULL);
if (compile) {
- compiler_.reset(new Compiler(kThumb2, false, 2, false, NULL));
+ compiler_.reset(new Compiler(kThumb2, false, 2, false, NULL, true, true));
compiler_->CompileAll(class_loader.get(), class_linker->GetBootClassPath());
}