Cumulative timing logger

Added a new class: Cumulative timing logger. This logger enables us to get an average of how long each Gc phase takes.

Change-Id: I87874d4c25b5935ef30ef593a9bd36a27e45ae14
diff --git a/src/utils.h b/src/utils.h
index 335a669..72303f0 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -36,6 +36,13 @@
 class Object;
 class String;
 
+enum TimeUnit {
+  kTimeUnitNanosecond,
+  kTimeUnitMicrosecond,
+  kTimeUnitMillisecond,
+  kTimeUnitSecond,
+};
+
 template<typename T>
 static inline bool IsPowerOfTwo(T x) {
   return (x & (x - 1)) == 0;
@@ -206,6 +213,15 @@
 // e.g. "1ms", "1.000000001s", "1.001us"
 std::string PrettyDuration(uint64_t nano_duration);
 
+// Format a nanosecond time to specified units.
+std::string FormatDuration(uint64_t nano_duration, TimeUnit time_unit);
+
+// Get the appropriate unit for a nanosecond duration.
+TimeUnit GetAppropriateTimeUnit(uint64_t nano_duration);
+
+// Get the divisor to convert from a nanoseconds to a time unit
+uint64_t GetNsToTimeUnitDivisor(TimeUnit time_unit);
+
 // Performs JNI name mangling as described in section 11.3 "Linking Native Methods"
 // of the JNI spec.
 std::string MangleForJni(const std::string& s);