From 467673be893d135fb5ffd378bf15604117925a1c Mon Sep 17 00:00:00 2001 From: luodw1 Date: Wed, 9 Jan 2019 10:48:29 +0800 Subject: [PATCH] power:add UTC time when entry and exit suspend Change-Id: I1cb923cd01cec3c669dde0789a8c51a870d394fe Signed-off-by: luodw1 Reviewed-on: https://gerrit.mot.com/1291266 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- kernel/power/suspend.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 06a118fb6ded..45548e0e8be2 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -624,6 +625,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. @@ -638,7 +651,7 @@ int pm_suspend(suspend_state_t state) if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX) return -EINVAL; - pr_info("suspend entry (%s)\n", mem_sleep_labels[state]); + pm_suspend_marker("entry"); error = enter_state(state); if (error) { suspend_stats.fail++; @@ -646,7 +659,7 @@ int pm_suspend(suspend_state_t state) } else { suspend_stats.success++; } - pr_info("suspend exit\n"); + pm_suspend_marker("exit"); return error; } EXPORT_SYMBOL(pm_suspend); -- 2.20.1