ART: Make dex2oat timing a bit more granular

Add scoped timing for runtime creation and dex file opening. Allows
comparing (JIT) compile time to specific overhead inherent to all
compilations.

Bug: 24103765
Change-Id: I1f83daa7015745bffa0cec3a3357b045c8493d6a
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index f9520be..10ae1ca 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -1258,8 +1258,11 @@
     // from getting a statically linked version of dex2oat (because of dlsym and RTLD_NEXT).
     runtime_options.push_back(std::make_pair("-Xno-sig-chain", nullptr));
 
-    if (!CreateRuntime(runtime_options)) {
-      return false;
+    {
+      TimingLogger::ScopedTiming t_runtime("Create runtime", timings_);
+      if (!CreateRuntime(runtime_options)) {
+        return false;
+      }
     }
 
     // Runtime::Create acquired the mutator_lock_ that is normally given away when we
@@ -1334,6 +1337,7 @@
     if (boot_image_option_.empty()) {
       dex_files_ = class_linker->GetBootClassPath();
     } else {
+      TimingLogger::ScopedTiming t_dex("Opening dex files", timings_);
       if (dex_filenames_.empty()) {
         ATRACE_BEGIN("Opening zip archive from file descriptor");
         std::string error_msg;