Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d1f0f6f authored by Yu Tian's avatar Yu Tian Committed by Gerrit - the friendly Code Review server
Browse files

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
parent aab0c60a
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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; \
\
+23 −0
Original line number Diff line number Diff line
@@ -270,6 +270,21 @@ static inline uint64_t qdf_log_timestamp_to_usecs(uint64_t 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
#define QDF_LOG_TIMESTAMP_UNIT KERNEL_LOG
#define QDF_LOG_TIMESTAMP_CYCLES_PER_10_US 10
@@ -279,6 +294,14 @@ static inline uint64_t qdf_log_timestamp_to_usecs(uint64_t time)
	/* timestamps are already in micro seconds */
	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 */

static inline void qdf_log_timestamp_to_secs(uint64_t time, uint64_t *secs,