diff mbox series

PM: Show how long dpm_suspend_start() and dpm_suspend_end() take

Message ID 20190605161237.176983-1-bvanassche@acm.org (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show
Series PM: Show how long dpm_suspend_start() and dpm_suspend_end() take | expand

Commit Message

Bart Van Assche June 5, 2019, 4:12 p.m. UTC
When debugging device driver power management code it is convenient to
know how much time is spent in the "suspend start" and "suspend end"
phases. Hence log the time spent in these phases.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/base/power/main.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Comments

Bart Van Assche June 18, 2019, 10:54 p.m. UTC | #1
On 6/5/19 9:12 AM, Bart Van Assche wrote:
> When debugging device driver power management code it is convenient to
> know how much time is spent in the "suspend start" and "suspend end"
> phases. Hence log the time spent in these phases.

Ping?
Rafael J. Wysocki June 18, 2019, 10:56 p.m. UTC | #2
On Wed, Jun 19, 2019 at 12:54 AM Bart Van Assche <bvanassche@acm.org> wrote:
>
> On 6/5/19 9:12 AM, Bart Van Assche wrote:
> > When debugging device driver power management code it is convenient to
> > know how much time is spent in the "suspend start" and "suspend end"
> > phases. Hence log the time spent in these phases.
>
> Ping?

Already applied.
diff mbox series

Patch

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index dcfc0a36c8f7..1e84b8aa220f 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1631,17 +1631,20 @@  int dpm_suspend_late(pm_message_t state)
  */
 int dpm_suspend_end(pm_message_t state)
 {
-	int error = dpm_suspend_late(state);
+	ktime_t starttime = ktime_get();
+	int error;
+
+	error = dpm_suspend_late(state);
 	if (error)
-		return error;
+		goto out;
 
 	error = dpm_suspend_noirq(state);
-	if (error) {
+	if (error)
 		dpm_resume_early(resume_event(state));
-		return error;
-	}
 
-	return 0;
+out:
+	dpm_show_time(starttime, state, error, "end");
+	return error;
 }
 EXPORT_SYMBOL_GPL(dpm_suspend_end);
 
@@ -2034,6 +2037,7 @@  int dpm_prepare(pm_message_t state)
  */
 int dpm_suspend_start(pm_message_t state)
 {
+	ktime_t starttime = ktime_get();
 	int error;
 
 	error = dpm_prepare(state);
@@ -2042,6 +2046,7 @@  int dpm_suspend_start(pm_message_t state)
 		dpm_save_failed_step(SUSPEND_PREPARE);
 	} else
 		error = dpm_suspend(state);
+	dpm_show_time(starttime, state, error, "start");
 	return error;
 }
 EXPORT_SYMBOL_GPL(dpm_suspend_start);