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
This commit is contained in:
Sreelakshmi Konamki
2016-10-27 15:00:57 +05:30
committed by qcabuildsw
parent 3f82a0e32d
commit e2e313532a
5 changed files with 37 additions and 3 deletions

View File

@@ -267,4 +267,14 @@ void qdf_timer_module_init(void);
*/ */
void qdf_timer_module_deinit(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 */ #endif /* __QDF_MC_TIMER_H */

View File

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

View File

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

View File

@@ -702,3 +702,20 @@ void qdf_timer_module_deinit(void)
qdf_mutex_destroy(&persistent_timer_count_lock); qdf_mutex_destroy(&persistent_timer_count_lock);
} }
EXPORT_SYMBOL(qdf_timer_module_deinit); 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);

View File

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