surfaceflinger: add frame duration logging

Change-Id: Ib414a45e7e191f23a2726cbbbeb606e9ce68a3b5
diff --git a/services/surfaceflinger/EventLog/EventLog.cpp b/services/surfaceflinger/EventLog/EventLog.cpp
index 815242b..47bab83 100644
--- a/services/surfaceflinger/EventLog/EventLog.cpp
+++ b/services/surfaceflinger/EventLog/EventLog.cpp
@@ -31,17 +31,22 @@
 EventLog::EventLog() {
 }
 
-void EventLog::doLogJank(const String8& window, int32_t value) {
-    EventLog::TagBuffer buffer(LOGTAG_SF_JANK);
-    buffer.startList(2);
+void EventLog::doLogFrameDurations(const String8& window,
+        const int32_t* durations, size_t numDurations) {
+    EventLog::TagBuffer buffer(LOGTAG_SF_FRAME_DUR);
+    buffer.startList(1 + numDurations);
     buffer.writeString8(window);
-    buffer.writeInt32(value);
+    for (size_t i = 0; i < numDurations; i++) {
+        buffer.writeInt32(durations[i]);
+    }
     buffer.endList();
     buffer.log();
 }
 
-void EventLog::logJank(const String8& window, int32_t value) {
-    EventLog::getInstance().doLogJank(window, value);
+void EventLog::logFrameDurations(const String8& window,
+        const int32_t* durations, size_t numDurations) {
+    EventLog::getInstance().doLogFrameDurations(window, durations,
+            numDurations);
 }
 
 // ---------------------------------------------------------------------------
diff --git a/services/surfaceflinger/EventLog/EventLog.h b/services/surfaceflinger/EventLog/EventLog.h
index 2f1cd9b..5207514 100644
--- a/services/surfaceflinger/EventLog/EventLog.h
+++ b/services/surfaceflinger/EventLog/EventLog.h
@@ -30,7 +30,8 @@
 class EventLog : public Singleton<EventLog> {
 
 public:
-    static void logJank(const String8& window, int32_t value);
+    static void logFrameDurations(const String8& window,
+            const int32_t* durations, size_t numDurations);
 
 protected:
     EventLog();
@@ -72,8 +73,9 @@
     EventLog(const EventLog&);
     EventLog& operator =(const EventLog&);
 
-    enum { LOGTAG_SF_JANK = 60100 };
-    void doLogJank(const String8& window, int32_t value);
+    enum { LOGTAG_SF_FRAME_DUR = 60100 };
+    void doLogFrameDurations(const String8& window, const int32_t* durations,
+            size_t numDurations);
 };
 
 // ---------------------------------------------------------------------------
diff --git a/services/surfaceflinger/EventLog/EventLogTags.logtags b/services/surfaceflinger/EventLog/EventLogTags.logtags
index c83692f..791e0e4 100644
--- a/services/surfaceflinger/EventLog/EventLogTags.logtags
+++ b/services/surfaceflinger/EventLog/EventLogTags.logtags
@@ -30,9 +30,12 @@
 # 5: Id
 # 6: Percent
 # Default value for data of type int/long is 2 (bytes).
+#
+# See system/core/logcat/event.logtags for the master copy of the tags.
 
-# surfaceflinger
-60100 sf_jank (window|3),(value|1)
+# 60100 - 60199 reserved for surfaceflinger
+
+60100 sf_frame_dur (window|3),(dur0|1),(dur1|1),(dur2|1),(dur3|1),(dur4|1),(dur5|1),(dur6|1)
 
 # NOTE - the range 1000000-2000000 is reserved for partners and others who
 # want to define their own log tags without conflicting with the core platform.