power:add UTC time when entry and exit suspend
authorluodw1 <luodw1@motorola.com>
Wed, 9 Jan 2019 02:48:29 +0000 (10:48 +0800)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:30:32 +0000 (17:30 +0800)
Change-Id: I1cb923cd01cec3c669dde0789a8c51a870d394fe
Signed-off-by: luodw1 <luodw1@motorola.com>
Reviewed-on: https://gerrit.mot.com/1291266
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key

kernel/power/suspend.c

index 06a118fb6ded975287800dd6f2e9b06d7a6994d6..45548e0e8be2a19d667192c32bb5d0dd4f6b236c 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/mm.h>
+#include <linux/rtc.h>
 #include <linux/slab.h>
 #include <linux/export.h>
 #include <linux/suspend.h>
@@ -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);