PM / Suspend: Print wall time at suspend entry and exit
authorTodd Poynor <toddpoynor@google.com>
Wed, 30 May 2012 00:33:56 +0000 (17:33 -0700)
committerJohn Stultz <john.stultz@linaro.org>
Tue, 16 Feb 2016 21:53:34 +0000 (13:53 -0800)
Change-Id: I92f252414c013b018b9a392eae1ee039aa0e89dc
Signed-off-by: Todd Poynor <toddpoynor@google.com>
kernel/power/suspend.c

index f9fe133c13e24de8e91f4ea81abebe6c58a3fd23..a41c3fbac1e9f57abf51068df537e696cf475da9 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/suspend.h>
 #include <linux/syscore_ops.h>
 #include <linux/ftrace.h>
+#include <linux/rtc.h>
 #include <trace/events/power.h>
 #include <linux/compiler.h>
 #include <linux/moduleparam.h>
@@ -518,6 +519,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.
@@ -532,6 +545,7 @@ int pm_suspend(suspend_state_t state)
        if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
                return -EINVAL;
 
+       pm_suspend_marker("entry");
        error = enter_state(state);
        if (error) {
                suspend_stats.fail++;
@@ -539,6 +553,7 @@ int pm_suspend(suspend_state_t state)
        } else {
                suspend_stats.success++;
        }
+       pm_suspend_marker("exit");
        return error;
 }
 EXPORT_SYMBOL(pm_suspend);