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

Commit 00ff7d46 authored by Srinivas Ramana's avatar Srinivas Ramana
Browse files

time: sched_clock: record cycle count in suspend and resume



Record cycle count and kernel time in nano-seconds 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: default avatarSrinivas Ramana <sramana@codeaurora.org>
parent c1b67407
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -32,6 +32,10 @@ struct clock_data {
static struct hrtimer sched_clock_timer;
static int irqtime = -1;
static int initialized;
static u64 suspend_ns;
static u64 suspend_cycles;
static u64 resume_cycles;


core_param(irqtime, irqtime, int, 0400);

@@ -200,6 +204,11 @@ void __init sched_clock_postinit(void)
static int sched_clock_suspend(void)
{
	update_sched_clock();

	suspend_ns = cd.epoch_ns;
	suspend_cycles = cd.epoch_cyc;
	pr_info("suspend ns:%17llu	suspend cycles:%17llu\n",
				cd.epoch_ns, cd.epoch_cyc);
	hrtimer_cancel(&sched_clock_timer);
	cd.suspended = true;
	return 0;
@@ -208,6 +217,8 @@ static int sched_clock_suspend(void)
static void sched_clock_resume(void)
{
	cd.epoch_cyc = read_sched_clock();
	resume_cycles = cd.epoch_cyc;
	pr_info("resume cycles:%17llu\n", cd.epoch_cyc);
	hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL);
	cd.suspended = false;
}