linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / suspend: measure the time of filesystem syncing
@ 2019-02-03  5:20 Harry Pan
  2019-02-05 11:55 ` Rafael J. Wysocki
                   ` (3 more replies)
  0 siblings, 4 replies; 37+ messages in thread
From: Harry Pan @ 2019-02-03  5:20 UTC (permalink / raw)
  To: LKML; +Cc: gs0622, Harry Pan, rjw, pavel, len.brown, linux-pm

This patch gives the reader an intuitive metric of the time cost by
the kernel issuing a filesystem sync during suspend; although developer
can guess by the timestamp of next log or enable the ftrace power event
for manual calculation, this manner is easier to read and benefits the
automatic script.

Signed-off-by: Harry Pan <harry.pan@intel.com>
---
 kernel/power/suspend.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 0bd595a0b610..f3b7c64f2242 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -550,6 +550,8 @@ static void suspend_finish(void)
 static int enter_state(suspend_state_t state)
 {
 	int error;
+	ktime_t start, end, elapsed;
+	unsigned int elapsed_msecs;
 
 	trace_suspend_resume(TPS("suspend_enter"), state, true);
 	if (state == PM_SUSPEND_TO_IDLE) {
@@ -570,9 +572,14 @@ static int enter_state(suspend_state_t state)
 
 #ifndef CONFIG_SUSPEND_SKIP_SYNC
 	trace_suspend_resume(TPS("sync_filesystems"), 0, true);
+	start = ktime_get_boottime();
 	pr_info("Syncing filesystems ... ");
 	ksys_sync();
-	pr_cont("done.\n");
+	end = ktime_get_boottime();
+	elapsed = ktime_sub(end, start);
+	elapsed_msecs = ktime_to_ms(elapsed);
+	pr_cont("(elapsed %d.%03d seconds) done.\n", elapsed_msecs / 1000,
+		elapsed_msecs % 1000);
 	trace_suspend_resume(TPS("sync_filesystems"), 0, false);
 #endif
 
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2019-03-22  8:21 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-03  5:20 [PATCH] PM / suspend: measure the time of filesystem syncing Harry Pan
2019-02-05 11:55 ` Rafael J. Wysocki
2019-02-06 14:52   ` Pan, Harry
2019-02-05 21:23 ` Pavel Machek
2019-02-06 15:08   ` Pan, Harry
2019-02-06 15:31     ` Pan, Harry
2019-02-06 16:16     ` Pavel Machek
2019-02-12  0:40       ` Pan, Harry
2019-02-06 14:42 ` Harry Pan
2019-02-06 14:53   ` Pavel Machek
2019-02-12 23:21   ` Rafael J. Wysocki
2019-02-12 23:26     ` Rafael J. Wysocki
2019-02-12 23:35     ` Rafael J. Wysocki
2019-02-06 15:42 ` [PATCH v2] " Harry Pan
2019-02-14  7:16   ` [PATCH v3] " Harry Pan
2019-02-14 11:15   ` Harry Pan
2019-02-19 10:24     ` Rafael J. Wysocki
2019-02-20 16:44       ` Pan, Harry
2019-02-20 21:45         ` Rafael J. Wysocki
2019-02-22 15:56           ` Pan, Harry
2019-02-20 16:12     ` [PATCH v4] " Harry Pan
2019-02-20 16:18     ` Harry Pan
2019-02-22 14:54       ` [PATCH v5] PM / sleep: " Harry Pan
2019-02-24 19:37         ` kbuild test robot
2019-02-24 23:23         ` kbuild test robot
2019-02-22 15:49       ` Harry Pan
2019-02-22 17:54         ` Pavel Machek
2019-02-24  6:17         ` [PATCH v6 1/2] PM / sleep: refactor the filesystems sync to reduce duplication Harry Pan
2019-02-24  6:17           ` [PATCH v6 2/2] PM / sleep: measure the time of filesystems syncing Harry Pan
2019-02-24 20:30             ` kbuild test robot
2019-02-24 21:51             ` kbuild test robot
2019-02-25  9:44             ` [PATCH v7 1/2] PM / sleep: refactor the filesystems sync to reduce duplication Harry Pan
2019-02-25  9:44               ` [PATCH v7 2/2] PM / sleep: measure the time of filesystems syncing Harry Pan
2019-02-25 12:36             ` [PATCH v7 1/2] PM / sleep: refactor the filesystems sync to reduce duplication Harry Pan
2019-02-25 12:36               ` [PATCH v7 2/2] PM / sleep: measure the time of filesystems syncing Harry Pan
2019-03-22  8:21               ` [PATCH v7 1/2] PM / sleep: refactor the filesystems sync to reduce duplication Pavel Machek
2019-02-25  7:33         ` [PATCH v5] PM / sleep: measure the time of filesystem syncing kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).