[metrics] Add ClassLoadingTotalTime counter

This keeps track of how much time we spend in the class loading
process.

Testing instructions:

   adb shell setprop dalvik.vm.metrics.write-to-log true
   adb shell stop && adb shell start
   adb logcat -e "ART internal metrics"

Observer ClassLoadingTotalTime in internal metrics report. Example:

    *** ART internal metrics ***
      Metadata:
        timestamp_since_start_ms: 34555
        session_id: 2710488913234081424
        uid: 10065
        compilation_reason: Unknown
        compiler_filter: (unspecified)
      Metrics:
        ClassLoadingTotalTime: count = 120959
        ClassVerificationTotalTime: count = 216121
        JitMethodCompileTime: range = 0...1000000, buckets: 4482,10,2,3
    *** Done dumping ART internal metrics ***

Bug: 177591870
Test: Manual, see above
Change-Id: I24f0c94ab6af5e6cd9b0dc32122f2905c36cf3b7
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index d4f2e30..b98708e 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -43,6 +43,7 @@
 #include "base/hash_set.h"
 #include "base/leb128.h"
 #include "base/logging.h"
+#include "base/metrics/metrics.h"
 #include "base/mutex-inl.h"
 #include "base/os.h"
 #include "base/quasi_atomic.h"
@@ -3065,6 +3066,7 @@
                                                const dex::ClassDef& dex_class_def) {
   ScopedDefiningClass sdc(self);
   StackHandleScope<3> hs(self);
+  metrics::AutoTimer timer{GetMetrics()->ClassLoadingTotalTime()};
   auto klass = hs.NewHandle<mirror::Class>(nullptr);
 
   // Load the class from the dex file.