PM/Suspend:Print wall time at suspend entry and exit

Cherry pick this commit from defender to print "PM: suspend" with
wall time when enter and exit suspend.

Change-Id: I92f252414c013b018b9a392eae1ee039aa0e89dc
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: yangjq <yangjq@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1477734
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jialei Hao <haojl2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1778522
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
This commit is contained in:
Todd Poynor 2012-05-29 17:33:56 -07:00 • committed by Xiaojun Ji
commit 9e9542e987

View file

@ -27,6 +27,7 @@
#include <linux/syscore_ops.h>
#include <linux/swait.h>
#include <linux/ftrace.h>
#include <linux/rtc.h>
#include <trace/events/power.h>
#include <linux/compiler.h>
#include <linux/moduleparam.h>
@ -608,6 +609,18 @@ static int enter_state(suspend_state_t state)
return error;
}
static void pm_suspend_marker(char *annotation)
{
struct timespec ts;
struct rtc_time tm;
getnstimeofday(&ts);
rtc_time_to_tm(ts.tv_sec, &tm);
pr_info("PM: suspend %s %d-%02d-%02d %02d:%02d:%02d.%09lu UTC\n",
annotation, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec);
}
/**
* pm_suspend - Externally visible function for suspending the system.
* @state: System sleep state to enter.
@ -622,6 +635,7 @@ int pm_suspend(suspend_state_t state)
if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
return -EINVAL;
pm_suspend_marker("entry");
pr_info("suspend entry (%s)\n", mem_sleep_labels[state]);
error = enter_state(state);
if (error) {
@ -630,6 +644,7 @@ int pm_suspend(suspend_state_t state)
} else {
suspend_stats.success++;
}
pm_suspend_marker("exit");
pr_info("suspend exit\n");
return error;
}