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
This commit is contained in:
Yu Tian
2020-10-26 18:12:48 +08:00
committed by snandini
parent 93a4498eba
commit cee4dbb1c5
2 changed files with 28 additions and 5 deletions

View File

@@ -90,13 +90,13 @@ do { \
uint64_t BEFORE_LOCK_time; \
uint64_t AFTER_LOCK_time; \
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)
#define AFTER_LOCK(lock, 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.last_acquired = AFTER_LOCK_time; \
if (BEFORE_LOCK_is_locked) { \
@@ -121,11 +121,11 @@ do { \
do { \
uint64_t BEFORE_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)
#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) { \
lock->stats.acquired++; \
lock->stats.last_acquired = AFTER_LOCK_time; \
@@ -138,7 +138,7 @@ do { \
/* max_hold_time in US */
#define BEFORE_UNLOCK(lock, max_hold_time) \
do {\
uint64_t held_time = qdf_get_log_timestamp() - \
uint64_t held_time = qdf_get_log_timestamp_lightweight() - \
lock->stats.last_acquired; \
lock->stats.held_time += held_time; \
\