浏览代码

qcacmn: Change time format of MTRACE logs

qcacld-2.0 to qcacld-3.0 propagation

MTRACE logs timestamp format is different from logcat logs,
and it's difficult to correlate with other logs.

This fix changes the timeformat of MTRACE logs
from qtimer ticks to hr:min:sec:msec

Change-Id: I45e5d28fbeccd757648f05ce4e593d8ca4fe7804
CRS-Fixed: 1049125
Sreelakshmi Konamki 8 年之前
父节点
当前提交
e2e313532a
共有 5 个文件被更改,包括 37 次插入3 次删除
  1. 10 0
      qdf/inc/qdf_mc_timer.h
  2. 4 2
      qdf/inc/qdf_trace.h
  3. 1 0
      qdf/linux/src/i_qdf_mc_timer.h
  4. 17 0
      qdf/linux/src/qdf_mc_timer.c
  5. 5 1
      qdf/linux/src/qdf_trace.c

+ 10 - 0
qdf/inc/qdf_mc_timer.h

@@ -267,4 +267,14 @@ void qdf_timer_module_init(void);
  */
 void qdf_timer_module_deinit(void);
 
+/**
+ * qdf_get_time_of_the_day_in_hr_min_sec_usec() - Get system time
+ * @tbuf: Pointer to time stamp buffer
+ * @len: Time buffer size
+ *
+ * This function updates the 'tbuf' with system time in hr:min:sec:msec format
+ *
+ * Return: None
+ */
+void qdf_get_time_of_the_day_in_hr_min_sec_usec(char *tbuf, int len);
 #endif /* __QDF_MC_TIMER_H */

+ 4 - 2
qdf/inc/qdf_trace.h

@@ -121,7 +121,8 @@ typedef enum {
 
 /**
  * typedef struct qdf_trace_record_s - keep trace record
- * @time: timestamp
+ * @qtime: qtimer ticks
+ * @time: user timestamp
  * @module: module name
  * @code: hold record of code
  * @session: hold record of session
@@ -129,7 +130,8 @@ typedef enum {
  * @pid: hold pid of the process
  */
 typedef struct qdf_trace_record_s {
-	uint64_t time;
+	uint64_t qtime;
+	char time[18];
 	uint8_t module;
 	uint8_t code;
 	uint16_t session;

+ 1 - 0
qdf/linux/src/i_qdf_mc_timer.h

@@ -39,6 +39,7 @@
 #include <linux/timer.h>
 #include <linux/time.h>
 #include <linux/jiffies.h>
+#include <linux/rtc.h>
 
 /* Preprocessor definitions and constants */
 

+ 17 - 0
qdf/linux/src/qdf_mc_timer.c

@@ -702,3 +702,20 @@ void qdf_timer_module_deinit(void)
 	qdf_mutex_destroy(&persistent_timer_count_lock);
 }
 EXPORT_SYMBOL(qdf_timer_module_deinit);
+
+void qdf_get_time_of_the_day_in_hr_min_sec_usec(char *tbuf, int len)
+{
+	struct timeval tv;
+	struct rtc_time tm;
+	unsigned long local_time;
+
+	/* Format the Log time R#: [hr:min:sec.microsec] */
+	do_gettimeofday(&tv);
+	/* Convert rtc to local time */
+	local_time = (u32)(tv.tv_sec - (sys_tz.tz_minuteswest * 60));
+	rtc_time_to_tm(local_time, &tm);
+	scnprintf(tbuf, len,
+		"[%02d:%02d:%02d.%06lu]",
+		tm.tm_hour, tm.tm_min, tm.tm_sec, tv.tv_usec);
+}
+EXPORT_SYMBOL(qdf_get_time_of_the_day_in_hr_min_sec_usec);

+ 5 - 1
qdf/linux/src/qdf_trace.c

@@ -35,6 +35,7 @@
 #include <qdf_trace.h>
 #include <wlan_logging_sock_svc.h>
 #include "qdf_time.h"
+#include "qdf_mc_timer.h"
 /* Preprocessor definitions and constants */
 
 #define QDF_TRACE_BUFFER_SIZE (512)
@@ -528,6 +529,7 @@ void qdf_trace(uint8_t module, uint8_t code, uint16_t session, uint32_t data)
 {
 	tp_qdf_trace_record rec = NULL;
 	unsigned long flags;
+	char time[18];
 
 	if (!g_qdf_trace_data.enable)
 		return;
@@ -536,6 +538,7 @@ void qdf_trace(uint8_t module, uint8_t code, uint16_t session, uint32_t data)
 	if (NULL == qdf_trace_cb_table[module])
 		return;
 
+	qdf_get_time_of_the_day_in_hr_min_sec_usec(time, sizeof(time));
 	/* Aquire the lock so that only one thread at a time can fill the ring
 	 * buffer
 	 */
@@ -569,7 +572,8 @@ void qdf_trace(uint8_t module, uint8_t code, uint16_t session, uint32_t data)
 	rec->code = code;
 	rec->session = session;
 	rec->data = data;
-	rec->time = qdf_get_log_timestamp();
+	rec->qtime = qdf_get_log_timestamp();
+	scnprintf(rec->time, sizeof(rec->time), "%s", time);
 	rec->module = module;
 	rec->pid = (in_interrupt() ? 0 : current->pid);
 	g_qdf_trace_data.num_since_last_dump++;