Add histogram entries (timestamp and flush)

Add functions to write these entries into log

Add functionality to dump them in dumpsys

Bug: 36490717
Test: Write format entries and histogram entries in the log.
      Verify that format entries and histograms are dumped correctly

Change-Id: I2e0b48c63031e62875c08461b98653ecfe1442be
diff --git a/services/audioflinger/TypedLogger.h b/services/audioflinger/TypedLogger.h
index b922eb7..cc28095 100644
--- a/services/audioflinger/TypedLogger.h
+++ b/services/audioflinger/TypedLogger.h
@@ -32,6 +32,7 @@
 return hash
 
 offset_basis and FNV_prime values depend on the size of the hash output
+Following values are defined by FNV and should not be changed arbitrarily
 */
 
 template<typename T>
@@ -74,9 +75,16 @@
            std::min(line, 0xFFFFu);
 }
 
-#define LOGT(fmt, ...) logWriterTLS->logFormat(fmt, \
-        hash(__FILE__, __LINE__), \
-        ##__VA_ARGS__) // TODO: check null pointer
+// Write formatted entry to log
+#define LOGT(fmt, ...) logWriterTLS->logFormat((fmt), \
+                                               hash(__FILE__, __LINE__), \
+                                               ##__VA_ARGS__) // TODO: check null pointer
+
+// Write histogram timestamp entry
+#define LOG_HIST_TS() logWriterTLS->logHistTS(hash(__FILE__, __LINE__))
+
+// flush all histogram
+#define LOG_HIST_FLUSH() logWriterTLS->logHistFlush(hash(__FILE__, __LINE__))
 
 namespace android {
 extern "C" {
diff --git a/services/medialog/MediaLogService.h b/services/medialog/MediaLogService.h
index c6b99f1..06c721f 100644
--- a/services/medialog/MediaLogService.h
+++ b/services/medialog/MediaLogService.h
@@ -49,7 +49,8 @@
     // Internal dump
     static const int kDumpLockRetries = 50;
     static const int kDumpLockSleepUs = 20000;
-    static const size_t kMergeBufferSize = 16 * 1024; // TODO determine good value for this
+    // Size of merge buffer, in bytes
+    static const size_t kMergeBufferSize = 64 * 1024; // TODO determine good value for this
     static bool dumpTryLock(Mutex& mutex);
 
     Mutex               mLock;