Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp2381218ima; Sat, 2 Feb 2019 21:30:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN7DUqzUa2oh4ZNzKNlTO1uXF3zQGU+jpqpZGdibLBQ9psUO+fpAXM80Mpap4cDTz4PDzH6c X-Received: by 2002:a62:9f1b:: with SMTP id g27mr44763381pfe.87.1549171819088; Sat, 02 Feb 2019 21:30:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549171819; cv=none; d=google.com; s=arc-20160816; b=o/jFm3m3oYCtcRhX7MnLetuUJgUQNgCpP4DhUOiyScONYk4vdi4fiE8ztNtojEjrR7 S1G/xZdq9CUmC7WdHDs0CvdM+gNfUzHkEbpf37UbES0jWs3fD07t+HikwRUMXODqCLSk WyqsgW4aIAgeeo6E86kpDC0eIzrRMz8/CTqlUJGazvsmRCJSIK8ySoIKXuoBSGvxMAxv x2RY9m93xkqOsqdwAqCu9UAb1OdaDjCzT9t+wOB1VVHlSK4zaSEk7VUvRAvveeWjctuN hIgz7Rcyx9/VBfyR98Bi9Mh2rkd0mCsdJXbrSjNJgZGcRq9xSpWEWK1QcZS0SJVdLQ14 dUrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=hLOFogJZGosiE94EM5GSG1XvnmaPoR2JNYbNlV5elYk=; b=ttn9AwzCl+8cfMJslfuWlxdF3ar1I4PbM9kZyOpmmNrtVLioHzZ6l4Cb5mj9zqikRb cKtz5hRXZuuqzc6uU+ds9cCqHWeLxalsugsMEVLCBKCM1wrP9urf4NZWNxLqk4woX+cX /0vERGNT1UolJnHQH+2t0wJuT5wiSlPzPlBpwj7sl5iTVksHT0B4OtIyw5SxcCK0uFAI i15bHGlqe7E8TD9GUA+sEpohEpOwphS/w1/go1EXf0qZ1Qda6ejKrEsfobGq2pE4G0Jv 9ONFie4Ws0oZL82CfwAhEXDr2RC5w6rPa3J482iIyH9lxIewx9IoN39U5QCSEM5Cly6l Xr0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k11si11963638pgg.430.2019.02.02.21.29.36; Sat, 02 Feb 2019 21:30:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726700AbfBCF3a (ORCPT + 99 others); Sun, 3 Feb 2019 00:29:30 -0500 Received: from 61-228-33-44.dynamic-ip.hinet.net ([61.228.33.44]:49342 "EHLO E6440.gar.corp.intel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726077AbfBCF33 (ORCPT ); Sun, 3 Feb 2019 00:29:29 -0500 X-Greylist: delayed 557 seconds by postgrey-1.27 at vger.kernel.org; Sun, 03 Feb 2019 00:29:28 EST Received: from E6440.gar.corp.intel.com (localhost [127.0.0.1]) by E6440.gar.corp.intel.com (Postfix) with ESMTP id 070A1C0559; Sun, 3 Feb 2019 13:20:10 +0800 (CST) From: Harry Pan To: LKML Cc: gs0622@gmail.com, Harry Pan , rjw@rjwysocki.net, pavel@ucw.cz, len.brown@intel.com, linux-pm@vger.kernel.org Subject: [PATCH] PM / suspend: measure the time of filesystem syncing Date: Sun, 3 Feb 2019 13:20:07 +0800 Message-Id: <20190203052007.27392-1-harry.pan@intel.com> X-Mailer: git-send-email 2.18.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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