[metrics] Add timer conveniences

This adds convenience timers for each of the metrics. The timer's can be
backed by a Counter, in which case the Counter will store cumulative
time elapsed, or by a Histogram, in which case the timer will increment
a bucket based on the time between a particular start/stop pair.

Timers can either be manually started and stopped, or can be used
automatically in an RAII manner.

Bug: 170149255
Test: m test-art-host-gtest-art_libartbase_tests
Change-Id: I4fc77e35f3e7b67c12fc004b72bf4fe177dc3151
2 files changed