time: Add rq_stats snapshot

Add snapshot of runqueue stats module as of commit <e56fe938419e>
(Merge "uapi: Introduce V4L2_FLAG_CVPMETADATA_SKIP flag").

Added #ifdefery to allow rq_stats to actually be optional.

Change-Id: I3352a472c5b0ad61cc04317a1d6f26549bfcdc04
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
This commit is contained in:
Elliot Berman 2019-08-06 17:06:01 -07:00
commit b666a7e42a
5 changed files with 163 additions and 1 deletions

View file

@ -23,6 +23,7 @@
#include <linux/module.h>
#include <linux/irq_work.h>
#include <linux/posix-timers.h>
#include <linux/rq_stats.h>
#include <linux/timer.h>
#include <linux/context_tracking.h>
#include <linux/mm.h>
@ -1284,6 +1285,18 @@ void tick_irq_enter(void)
* High resolution timer specific code
*/
#ifdef CONFIG_HIGH_RES_TIMERS
#ifdef CONFIG_QCOM_RUN_QUEUE_STATS
static void wakeup_user(void)
{
unsigned long jiffy_gap;
jiffy_gap = jiffies - rq_info.def_timer_last_jiffy;
if (jiffy_gap >= rq_info.def_timer_jiffies) {
rq_info.def_timer_last_jiffy = jiffies;
queue_work(rq_wq, &rq_info.def_timer_work);
}
}
#endif
/*
* We rearm the timer until we get disabled by the idle code.
* Called with interrupts disabled.
@ -1301,8 +1314,18 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
* Do not call, when we are not in irq context and have
* no valid regs pointer
*/
if (regs)
if (regs) {
tick_sched_handle(ts, regs);
#ifdef CONFIG_QCOM_RUN_QUEUE_STATS
if (rq_info.init == 1 &&
tick_do_timer_cpu == smp_processor_id()) {
/*
* wakeup user if needed
*/
wakeup_user();
}
#endif
}
else
ts->next_tick = 0;