From patchwork Sun Feb 24 06:17:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Pan X-Patchwork-Id: 10827731 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 631506C2 for ; Sun, 24 Feb 2019 06:27:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47574285D5 for ; Sun, 24 Feb 2019 06:27:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35F162A2EE; Sun, 24 Feb 2019 06:27:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE88F285D5 for ; Sun, 24 Feb 2019 06:27:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726306AbfBXG1S (ORCPT ); Sun, 24 Feb 2019 01:27:18 -0500 Received: from 61-228-51-238.dynamic-ip.hinet.net ([61.228.51.238]:35352 "EHLO E6440.gar.corp.intel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725817AbfBXG1S (ORCPT ); Sun, 24 Feb 2019 01:27:18 -0500 X-Greylist: delayed 561 seconds by postgrey-1.27 at vger.kernel.org; Sun, 24 Feb 2019 01:27:18 EST Received: from E6440.gar.corp.intel.com (localhost [127.0.0.1]) by E6440.gar.corp.intel.com (Postfix) with ESMTP id 8A76BC1602; Sun, 24 Feb 2019 14:18:16 +0800 (CST) From: Harry Pan To: LKML Cc: harry.pan@intel.com, gs0622@gmail.com, rjw@rjwysocki.net, pavel@ucw.cz, len.brown@intel.com, linux-pm@vger.kernel.org Subject: [PATCH v6 2/2] PM / sleep: measure the time of filesystems syncing Date: Sun, 24 Feb 2019 14:17:54 +0800 Message-Id: <20190224061753.17638-2-harry.pan@intel.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20190224061753.17638-1-harry.pan@intel.com> References: <20190222154904.6260-1-harry.pan@intel.com> <20190224061753.17638-1-harry.pan@intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch gives the reader an intuitive metric of the time cost by the kernel issuing filesystems sync during system sleep; 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 automation script. Signed-off-by: Harry Pan --- kernel/power/main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/power/main.c b/kernel/power/main.c index a8a8e6ec57e6..a08dcc743f31 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -54,9 +54,15 @@ EXPORT_SYMBOL_GPL(unlock_system_sleep); void ksys_sync_helper(void) { - pr_info("Syncing filesystems ... "); + ktime_t start; + s64 elapsed_msecs; + + start = ktime_get(); ksys_sync(); - pr_cont("done.\n"); + elapsed_msecs = ktime_to_ms(ktime_sub(ktime_get(), start)); + pr_info("Filesystems sync: %lld.%03lld seconds\n", + elapsed_msecs / MSEC_PER_SEC, + elapsed_msecs % MSEC_PER_SEC); } EXPORT_SYMBOL_GPL(ksys_sync_helper);