summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorSrinivas Ramana <sramana@codeaurora.org>2016-11-23 16:43:42 +0530
committerSrinivas Ramana <sramana@codeaurora.org>2016-12-09 17:50:42 +0530
commitfa50fc268b8e891db927235c5ef18d439c049c7a (patch)
tree6c178dbed4055609b57394babf3f459288982fa3 /kernel
parent69352ff8b46b11f98bf37f82534a82222466eadd (diff)
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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/sched_clock.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
index 0637823aa5a6..699aff70bbfa 100644
--- a/kernel/time/sched_clock.c
+++ b/kernel/time/sched_clock.c
@@ -71,6 +71,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);
@@ -282,6 +286,11 @@ static int sched_clock_suspend(void)
struct clock_read_data *rd = &cd.read_data[0];
update_sched_clock();
+
+ 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);
hrtimer_cancel(&sched_clock_timer);
rd->read_sched_clock = suspended_sched_clock_read;
@@ -293,6 +302,8 @@ static void sched_clock_resume(void)
struct clock_read_data *rd = &cd.read_data[0];
rd->epoch_cyc = cd.actual_read_sched_clock();
+ resume_cycles = rd->epoch_cyc;
+ pr_info("resume cycles:%17llu\n", rd->epoch_cyc);
hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL);
rd->read_sched_clock = cd.actual_read_sched_clock;
}