Skip to content
Snippets Groups Projects
Commit 23016def authored by Todd Poynor's avatar Todd Poynor
Browse files

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


Change-Id: I92f252414c013b018b9a392eae1ee039aa0e89dc
Signed-off-by: default avatarTodd Poynor <toddpoynor@google.com>
parent 6411d578
Branches
Tags
No related merge requests found
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/export.h> #include <linux/export.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/syscore_ops.h> #include <linux/syscore_ops.h>
#include <linux/rtc.h>
#include <trace/events/power.h> #include <trace/events/power.h>
#include "power.h" #include "power.h"
...@@ -300,6 +301,18 @@ static int enter_state(suspend_state_t state) ...@@ -300,6 +301,18 @@ static int enter_state(suspend_state_t state)
return error; 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. * pm_suspend - Externally visible function for suspending the system.
* @state: System sleep state to enter. * @state: System sleep state to enter.
...@@ -314,6 +327,7 @@ int pm_suspend(suspend_state_t state) ...@@ -314,6 +327,7 @@ int pm_suspend(suspend_state_t state)
if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX) if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
return -EINVAL; return -EINVAL;
pm_suspend_marker("entry");
error = enter_state(state); error = enter_state(state);
if (error) { if (error) {
suspend_stats.fail++; suspend_stats.fail++;
...@@ -321,6 +335,7 @@ int pm_suspend(suspend_state_t state) ...@@ -321,6 +335,7 @@ int pm_suspend(suspend_state_t state)
} else { } else {
suspend_stats.success++; suspend_stats.success++;
} }
pm_suspend_marker("exit");
return error; return error;
} }
EXPORT_SYMBOL(pm_suspend); EXPORT_SYMBOL(pm_suspend);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment