[metrics] Add background reporting thread

This adds a background thread that reports metrics every N seconds,
where N is specified by the -Xmetrics-reporting-period command line
option. Periodic reporting is disabled by default.

Test: test/run-test --host test/2233-metrics-background-thread
Test: adb shell stop && \
      adb shell setprop dalvik.vm.extra-opts \
          -Xmetrics-reporting-period=30\\\ -Xwrite-metrics-to-log && \
      adb shell start && \
      adb logcat  # observe metrics in log
Change-Id: I4d6ae7701dd2fe36bc761ef6170ddd6860a3c0e6
14 files changed