diff options
-rw-r--r-- | compiler/image_test.cc | 2 | ||||
-rw-r--r-- | compiler/oat_test.cc | 5 | ||||
-rw-r--r-- | compiler/oat_writer.cc | 34 | ||||
-rw-r--r-- | compiler/oat_writer.h | 3 | ||||
-rw-r--r-- | dex2oat/dex2oat.cc | 5 |
5 files changed, 37 insertions, 12 deletions
diff --git a/compiler/image_test.cc b/compiler/image_test.cc index e22e702..a8a9d2e 100644 --- a/compiler/image_test.cc +++ b/compiler/image_test.cc @@ -60,7 +60,7 @@ TEST_F(ImageTest, WriteRead) { ScopedObjectAccess soa(Thread::Current()); OatWriter oat_writer(class_linker->GetBootClassPath(), - 0, 0, "", compiler_driver_.get()); + 0, 0, "", compiler_driver_.get(), &timings); bool success = compiler_driver_->WriteElf(GetTestAndroidRoot(), !kIsTargetBuild, class_linker->GetBootClassPath(), diff --git a/compiler/oat_test.cc b/compiler/oat_test.cc index 714ec4e..fd0a69d 100644 --- a/compiler/oat_test.cc +++ b/compiler/oat_test.cc @@ -67,6 +67,7 @@ class OatTest : public CommonTest { }; TEST_F(OatTest, WriteRead) { + TimingLogger timings("CommonTest::WriteRead", false, false); ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); // TODO: make selectable @@ -92,7 +93,8 @@ TEST_F(OatTest, WriteRead) { 42U, 4096U, "lue.art", - compiler_driver_.get()); + compiler_driver_.get(), + &timings); bool success = compiler_driver_->WriteElf(GetTestAndroidRoot(), !kIsTargetBuild, class_linker->GetBootClassPath(), @@ -101,7 +103,6 @@ TEST_F(OatTest, WriteRead) { ASSERT_TRUE(success); if (kCompile) { // OatWriter strips the code, regenerate to compare - TimingLogger timings("CommonTest::WriteRead", false, false); compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath(), timings); } std::string error_msg; diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc index 28fb147..8382469 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -40,7 +40,8 @@ OatWriter::OatWriter(const std::vector<const DexFile*>& dex_files, uint32_t image_file_location_oat_checksum, uint32_t image_file_location_oat_begin, const std::string& image_file_location, - const CompilerDriver* compiler) + const CompilerDriver* compiler, + TimingLogger* timings) : compiler_driver_(compiler), dex_files_(&dex_files), image_file_location_oat_checksum_(image_file_location_oat_checksum), @@ -77,12 +78,31 @@ OatWriter::OatWriter(const std::vector<const DexFile*>& dex_files, size_oat_class_status_(0), size_oat_class_method_bitmaps_(0), size_oat_class_method_offsets_(0) { - size_t offset = InitOatHeader(); - offset = InitOatDexFiles(offset); - offset = InitDexFiles(offset); - offset = InitOatClasses(offset); - offset = InitOatCode(offset); - offset = InitOatCodeDexFiles(offset); + size_t offset; + { + TimingLogger::ScopedSplit split("InitOatHeader", timings); + offset = InitOatHeader(); + } + { + TimingLogger::ScopedSplit split("InitOatDexFiles", timings); + offset = InitOatDexFiles(offset); + } + { + TimingLogger::ScopedSplit split("InitDexFiles", timings); + offset = InitDexFiles(offset); + } + { + TimingLogger::ScopedSplit split("InitOatClasses", timings); + offset = InitOatClasses(offset); + } + { + TimingLogger::ScopedSplit split("InitOatCode", timings); + offset = InitOatCode(offset); + } + { + TimingLogger::ScopedSplit split("InitOatCodeDexFiles", timings); + offset = InitOatCodeDexFiles(offset); + } size_ = offset; CHECK_EQ(dex_files_->size(), oat_dex_files_.size()); diff --git a/compiler/oat_writer.h b/compiler/oat_writer.h index 5d947cf..64275e6 100644 --- a/compiler/oat_writer.h +++ b/compiler/oat_writer.h @@ -67,7 +67,8 @@ class OatWriter { uint32_t image_file_location_oat_checksum, uint32_t image_file_location_oat_begin, const std::string& image_file_location, - const CompilerDriver* compiler); + const CompilerDriver* compiler, + TimingLogger* timings); const OatHeader& GetOatHeader() const { return *oat_header_; diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index fada66a..8b23270 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -280,6 +280,7 @@ class Dex2Oat { uint32_t image_file_location_oat_checksum = 0; uint32_t image_file_location_oat_data_begin = 0; if (!driver->IsImage()) { + TimingLogger::ScopedSplit split("Loading image checksum", &timings); gc::space::ImageSpace* image_space = Runtime::Current()->GetHeap()->GetImageSpace(); image_file_location_oat_checksum = image_space->GetImageHeader().GetOatChecksum(); image_file_location_oat_data_begin = @@ -294,8 +295,10 @@ class Dex2Oat { image_file_location_oat_checksum, image_file_location_oat_data_begin, image_file_location, - driver.get()); + driver.get(), + &timings); + TimingLogger::ScopedSplit split("Writing ELF", &timings); if (!driver->WriteElf(android_root, is_host, dex_files, oat_writer, oat_file)) { LOG(ERROR) << "Failed to write ELF file " << oat_file->GetPath(); return NULL; |