ART: Add --dump-pass-timings compiler option.

This replaces the old --dump-passes option removed in
    https://android-review.googlesource.com/549200 .
Using --dump-timing for timing optimization passes makes
the high level timings useless, so return to using two
different options for these.

Test: Manually run dex2oat with --dump-timings,
      --dump-pass-timings and both.
Change-Id: Iddc4cfee35652fb493656e7d6081a898c2894f72
diff --git a/compiler/driver/compiler_options.cc b/compiler/driver/compiler_options.cc
index 2d82d79..933be4f 100644
--- a/compiler/driver/compiler_options.cc
+++ b/compiler/driver/compiler_options.cc
@@ -51,6 +51,7 @@
       implicit_suspend_checks_(false),
       compile_pic_(false),
       dump_timings_(false),
+      dump_pass_timings_(false),
       dump_stats_(false),
       verbose_methods_(),
       abort_on_hard_verifier_failure_(false),
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index cdd9d4d..cee989b 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -270,6 +270,10 @@
     return dump_timings_;
   }
 
+  bool GetDumpPassTimings() const {
+    return dump_pass_timings_;
+  }
+
   bool GetDumpStats() const {
     return dump_stats_;
   }
@@ -316,6 +320,7 @@
   bool implicit_suspend_checks_;
   bool compile_pic_;
   bool dump_timings_;
+  bool dump_pass_timings_;
   bool dump_stats_;
 
   // Vector of methods to have verbose output enabled for.
diff --git a/compiler/driver/compiler_options_map-inl.h b/compiler/driver/compiler_options_map-inl.h
index 3b18db0..32fc887 100644
--- a/compiler/driver/compiler_options_map-inl.h
+++ b/compiler/driver/compiler_options_map-inl.h
@@ -85,6 +85,10 @@
     options->dump_timings_ = true;
   }
 
+  if (map.Exists(Base::DumpPassTimings)) {
+    options->dump_pass_timings_ = true;
+  }
+
   if (map.Exists(Base::DumpStats)) {
     options->dump_stats_ = true;
   }
@@ -146,6 +150,9 @@
       .Define({"--dump-timings"})
           .IntoKey(Map::DumpTimings)
 
+      .Define({"--dump-pass-timings"})
+          .IntoKey(Map::DumpPassTimings)
+
       .Define({"--dump-stats"})
           .IntoKey(Map::DumpStats)
 
diff --git a/compiler/driver/compiler_options_map.def b/compiler/driver/compiler_options_map.def
index acddae7..529d43f 100644
--- a/compiler/driver/compiler_options_map.def
+++ b/compiler/driver/compiler_options_map.def
@@ -60,6 +60,7 @@
 COMPILER_OPTIONS_KEY (bool,                        DeduplicateCode,        true)
 COMPILER_OPTIONS_KEY (Unit,                        CountHotnessInCompiledCode)
 COMPILER_OPTIONS_KEY (Unit,                        DumpTimings)
+COMPILER_OPTIONS_KEY (Unit,                        DumpPassTimings)
 COMPILER_OPTIONS_KEY (Unit,                        DumpStats)
 
 #undef COMPILER_OPTIONS_KEY
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 6e2c994..c4977de 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -109,7 +109,7 @@
       : graph_(graph),
         last_seen_graph_size_(0),
         cached_method_name_(),
-        timing_logger_enabled_(compiler_driver->GetCompilerOptions().GetDumpTimings()),
+        timing_logger_enabled_(compiler_driver->GetCompilerOptions().GetDumpPassTimings()),
         timing_logger_(timing_logger_enabled_ ? GetMethodName() : "", true, true),
         disasm_info_(graph->GetAllocator()),
         visualizer_oss_(),
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index df38ee3..3252354 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -350,6 +350,9 @@
   UsageError("");
   UsageError("  --dump-timings: display a breakdown of where time was spent");
   UsageError("");
+  UsageError("  --dump-pass-timings: display a breakdown of time spent in optimization");
+  UsageError("      passes for each compiled method.");
+  UsageError("");
   UsageError("  -g");
   UsageError("  --generate-debug-info: Generate debug information for native debugging,");
   UsageError("      such as stack unwinding information, ELF symbols and DWARF sections.");