time: sched_clock: record cycle count in suspend and resume

Record cycle count and kernel time in ns while entering suspend
and while resuming. This will help in matching up the kernel time
with external subsystems and in recording suspend time in cycles.

Change-Id: If22d9880103c7d54087d0faf4c992259e6b97f08
Signed-off-by: Srinivas Ramana <sramana@codeaurora.org>
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
This commit is contained in:
Srinivas Ramana 2016-11-23 16:43:42 +05:30 • committed by Murali Nalajala
commit f121a71abb

View file

@ -71,6 +71,12 @@ struct clock_data {
static struct hrtimer sched_clock_timer;
static int irqtime = -1;
#ifdef CONFIG_PRINT_SUSPEND_EPOCH_QGKI
static u64 suspend_ns;
static u64 suspend_cycles;
static u64 resume_cycles;
#endif
core_param(irqtime, irqtime, int, 0400);
static u64 notrace jiffy_sched_clock_read(void)
@ -280,6 +286,13 @@ int sched_clock_suspend(void)
struct clock_read_data *rd = &cd.read_data[0];
update_sched_clock();
#ifdef CONFIG_PRINT_SUSPEND_EPOCH_QGKI
suspend_ns = rd->epoch_ns;
suspend_cycles = rd->epoch_cyc;
pr_info("suspend ns:%17llu suspend cycles:%17llu\n",
rd->epoch_ns, rd->epoch_cyc);
#endif
hrtimer_cancel(&sched_clock_timer);
rd->read_sched_clock = suspended_sched_clock_read;
@ -292,6 +305,10 @@ void sched_clock_resume(void)
rd->epoch_cyc = cd.actual_read_sched_clock();
hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL_HARD);
#ifdef CONFIG_PRINT_SUSPEND_EPOCH_QGKI
resume_cycles = rd->epoch_cyc;
pr_info("resume cycles:%17llu\n", rd->epoch_cyc);
#endif
rd->read_sched_clock = cd.actual_read_sched_clock;
}