Merge "msm: rtb: Add timestamp to rtb logging"
diff --git a/arch/arm/mach-msm/msm_rtb.c b/arch/arm/mach-msm/msm_rtb.c
index f630d2b..6a71e36 100644
--- a/arch/arm/mach-msm/msm_rtb.c
+++ b/arch/arm/mach-msm/msm_rtb.c
@@ -36,20 +36,22 @@
 #define RTB_COMPAT_STR	"qcom,msm-rtb"
 
 /* Write
- * 1) 11 bytes sentinel
+ * 1) 3 bytes sentinel
  * 2) 1 bytes of log type
  * 3) 8 bytes of where the caller came from
  * 4) 4 bytes index
  * 4) 8 bytes extra data from the caller
+ * 5) 8 bytes for timestamp
  *
  * Total = 32 bytes.
  */
 struct msm_rtb_layout {
-	unsigned char sentinel[11];
+	unsigned char sentinel[3];
 	unsigned char log_type;
 	uint32_t idx;
 	uint64_t caller;
 	uint64_t data;
+	uint64_t timestamp;
 } __attribute__ ((__packed__));
 
 
@@ -125,6 +127,11 @@
 	start->data = data;
 }
 
+static void msm_rtb_write_timestamp(struct msm_rtb_layout *start)
+{
+	start->timestamp = sched_clock();
+}
+
 static void uncached_logk_pc_idx(enum logk_event_type log_type, uint64_t caller,
 				 uint64_t data, int idx)
 {
@@ -137,6 +144,7 @@
 	msm_rtb_write_caller(caller, start);
 	msm_rtb_write_idx(idx, start);
 	msm_rtb_write_data(data, start);
+	msm_rtb_write_timestamp(start);
 	mb();
 
 	return;