All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Mark Salyzyn <salyzyn@android.com>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	Todd Poynor <toddpoynor@google.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>
Subject: Re: PM / Suspend: Print wall time at suspend entry and exit
Date: Mon, 5 Jun 2017 22:07:13 +0200	[thread overview]
Message-ID: <20170605200713.GB24496@amd> (raw)
In-Reply-To: <20170605193157.59875-1-salyzyn@android.com>

[-- Attachment #1: Type: text/plain, Size: 2079 bytes --]

On Mon 2017-06-05 12:31:14, Mark Salyzyn wrote:
> Permits power state and battery life diagnosis.
> 
> Signed-off-by: Todd Poynor <toddpoynor@google.com>
> Signed-off-by: Mark Salyzyn <salyzyn@android.com>

I don't particulary like it (RTC is slow on PC class machines), but I
guess the information is useful.

Acked-by: Pavel Machek <pavel@ucw.cz>

> ---
>  kernel/power/suspend.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
> index c0248c74d6d4..464175f04bc5 100644
> --- a/kernel/power/suspend.c
> +++ b/kernel/power/suspend.c
> @@ -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>
> @@ -563,6 +564,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.
> @@ -577,6 +590,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++;
> @@ -584,6 +598,7 @@ int pm_suspend(suspend_state_t state)
>  	} else {
>  		suspend_stats.success++;
>  	}
> +	pm_suspend_marker("exit");
>  	return error;
>  }
>  EXPORT_SYMBOL(pm_suspend);

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  parent reply	other threads:[~2017-06-05 20:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-05 19:31 PM / Suspend: Print wall time at suspend entry and exit Mark Salyzyn
2017-06-05 19:31 ` PM / Hibernation: Print wall time at hibernation " Mark Salyzyn
2017-06-05 20:07 ` Pavel Machek [this message]
2017-06-05 20:58 ` PM / Suspend: Print wall time at suspend " Rafael J. Wysocki
2017-06-05 21:18   ` Pavel Machek
2017-06-05 21:47     ` Mark Salyzyn
2017-06-05 22:10       ` Mark Salyzyn
2017-06-05 22:40         ` Pavel Machek
2017-06-06 18:05           ` Mark Salyzyn
2017-07-13  8:54             ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170605200713.GB24496@amd \
    --to=pavel@ucw.cz \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=salyzyn@android.com \
    --cc=toddpoynor@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.