diff --git a/qdf/inc/qdf_mc_timer.h b/qdf/inc/qdf_mc_timer.h index 3a899c9da751..6417fa609372 100644 --- a/qdf/inc/qdf_mc_timer.h +++ b/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 */ diff --git a/qdf/inc/qdf_trace.h b/qdf/inc/qdf_trace.h index 6070d973d200..e95dbc636e7e 100644 --- a/qdf/inc/qdf_trace.h +++ b/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; diff --git a/qdf/linux/src/i_qdf_mc_timer.h b/qdf/linux/src/i_qdf_mc_timer.h index ced41e3fce58..f7d6df7ad18e 100644 --- a/qdf/linux/src/i_qdf_mc_timer.h +++ b/qdf/linux/src/i_qdf_mc_timer.h @@ -39,6 +39,7 @@ #include #include #include +#include /* Preprocessor definitions and constants */ diff --git a/qdf/linux/src/qdf_mc_timer.c b/qdf/linux/src/qdf_mc_timer.c index 75527e741f62..b42b3cf87530 100644 --- a/qdf/linux/src/qdf_mc_timer.c +++ b/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); diff --git a/qdf/linux/src/qdf_trace.c b/qdf/linux/src/qdf_trace.c index 79c5841e1c3b..00ad2476dc19 100644 --- a/qdf/linux/src/qdf_trace.c +++ b/qdf/linux/src/qdf_trace.c @@ -35,6 +35,7 @@ #include #include #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++;