1
0

qcacmn: Implement a light weight get_timestamp routine

For some 3rd party platforms, get_timestamp through legacy
kernel API is time costing. For spin_lock/unlock statistics
info, the resolution in ms level is enough. So use another
light weight API to save CPU resource for 3rd party
platforms only.

Change-Id: I9182f00adda0d3081a2c40b222ab37bb1ca9d6a1
CRs-Fixed: 2796263
Este cometimento está contido em:
Yu Tian
2020-10-26 18:12:48 +08:00
cometido por snandini
ascendente 93a4498eba
cometimento cee4dbb1c5
2 ficheiros modificados com 28 adições e 5 eliminações

Ver ficheiro

@@ -90,13 +90,13 @@ do { \
uint64_t BEFORE_LOCK_time; \ uint64_t BEFORE_LOCK_time; \
uint64_t AFTER_LOCK_time; \ uint64_t AFTER_LOCK_time; \
bool BEFORE_LOCK_is_locked = was_locked; \ bool BEFORE_LOCK_is_locked = was_locked; \
BEFORE_LOCK_time = qdf_get_log_timestamp(); \ BEFORE_LOCK_time = qdf_get_log_timestamp_lightweight(); \
do {} while (0) do {} while (0)
#define AFTER_LOCK(lock, func) \ #define AFTER_LOCK(lock, func) \
lock->stats.acquired_by = func; \ lock->stats.acquired_by = func; \
AFTER_LOCK_time = qdf_get_log_timestamp(); \ AFTER_LOCK_time = qdf_get_log_timestamp_lightweight(); \
lock->stats.acquired++; \ lock->stats.acquired++; \
lock->stats.last_acquired = AFTER_LOCK_time; \ lock->stats.last_acquired = AFTER_LOCK_time; \
if (BEFORE_LOCK_is_locked) { \ if (BEFORE_LOCK_is_locked) { \
@@ -121,11 +121,11 @@ do { \
do { \ do { \
uint64_t BEFORE_LOCK_time; \ uint64_t BEFORE_LOCK_time; \
uint64_t AFTER_LOCK_time; \ uint64_t AFTER_LOCK_time; \
BEFORE_LOCK_time = qdf_get_log_timestamp(); \ BEFORE_LOCK_time = qdf_get_log_timestamp_lightweight(); \
do {} while (0) do {} while (0)
#define AFTER_TRYLOCK(lock, trylock_return, func) \ #define AFTER_TRYLOCK(lock, trylock_return, func) \
AFTER_LOCK_time = qdf_get_log_timestamp(); \ AFTER_LOCK_time = qdf_get_log_timestamp_lightweight(); \
if (trylock_return) { \ if (trylock_return) { \
lock->stats.acquired++; \ lock->stats.acquired++; \
lock->stats.last_acquired = AFTER_LOCK_time; \ lock->stats.last_acquired = AFTER_LOCK_time; \
@@ -138,7 +138,7 @@ do { \
/* max_hold_time in US */ /* max_hold_time in US */
#define BEFORE_UNLOCK(lock, max_hold_time) \ #define BEFORE_UNLOCK(lock, max_hold_time) \
do {\ do {\
uint64_t held_time = qdf_get_log_timestamp() - \ uint64_t held_time = qdf_get_log_timestamp_lightweight() - \
lock->stats.last_acquired; \ lock->stats.last_acquired; \
lock->stats.held_time += held_time; \ lock->stats.held_time += held_time; \
\ \

Ver ficheiro

@@ -281,6 +281,21 @@ static inline uint64_t qdf_log_timestamp_to_usecs(uint64_t time)
return time; return time;
} }
/**
* qdf_get_log_timestamp_lightweight - get time stamp for logging
* For adrastea this API returns QTIMER tick which is needed to synchronize
* host and fw log timestamps
* For ROME and other discrete solution this API returns system boot time stamp
*
* Return:
* QTIMER ticks(19.2MHz) for adrastea
* System tick for rome and other 3rd party platform solutions
*/
static inline uint64_t qdf_get_log_timestamp_lightweight(void)
{
return __qdf_get_log_timestamp();
}
#else #else
#define QDF_LOG_TIMESTAMP_UNIT KERNEL_LOG #define QDF_LOG_TIMESTAMP_UNIT KERNEL_LOG
#define QDF_LOG_TIMESTAMP_CYCLES_PER_10_US 10 #define QDF_LOG_TIMESTAMP_CYCLES_PER_10_US 10
@@ -290,6 +305,14 @@ static inline uint64_t qdf_log_timestamp_to_usecs(uint64_t time)
/* timestamps are already in micro seconds */ /* timestamps are already in micro seconds */
return time; return time;
} }
static inline uint64_t qdf_get_log_timestamp_lightweight(void)
{
uint64_t timestamp_us;
timestamp_us = __qdf_system_ticks_to_msecs(qdf_system_ticks()) * 1000;
return timestamp_us;
}
#endif /* end of MSM_PLATFORM */ #endif /* end of MSM_PLATFORM */
static inline void qdf_log_timestamp_to_secs(uint64_t time, uint64_t *secs, static inline void qdf_log_timestamp_to_secs(uint64_t time, uint64_t *secs,