Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp4937079ima; Tue, 5 Feb 2019 03:57:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IYrv7aaLLl6gLu7nzil/uyRAkvDu+IVLrWfpcsAuReG0T2y0Qp7+Qiprr4TZlNVuMXZQ2Cj X-Received: by 2002:a17:902:8c91:: with SMTP id t17mr4782839plo.212.1549367826894; Tue, 05 Feb 2019 03:57:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549367826; cv=none; d=google.com; s=arc-20160816; b=ZDxrl86JPQ+eGlzYfn6KxgVwqppBtw0pMLICEhn2CK7uZquhoCr0jDd0M1AqDe25XJ zmKg8/OTKJ/upjTzamk8fAX/5KkET887ctc41QOUAvh/thxDTh+e3eSnctU4sBgRUOO9 hJ8WATNUiOd+8ZRqQEdmfiTMW/1iTODi26jb3d6lFM/fMnaPWOK92Souo+ZIb+KgC4Np P2erIQFWm1nthdyAXwYe+yQ/QG/AAv6ux/ee8owSZ9Iz5oN4jBynNoZUd3g6qDp+wF5K JBme6qLw2W5z1GVsgptbapZy7SUIAa8nUWvrQFSpXKpNNpChNdXbVuknwmy691+lmDhD ufbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=K1e6QrrxVlxk9605FTYmFEXaegPuRKavEAxvYvGZ770=; b=n+mfs1+49gG8dlENndCAudAzNtWvHXcBIL+Aa1YVb+fnsgo/2EQzfIqpYEJk+JsE/q 8uMY57FU7Wq30MnIziNhQfEEXlcr8hNM+crpeekkGmJJQnqPCvwU16VBwogDmohP/xuW Ikhf56to38iV4Hfjrh8pYZslkZ7go3pCC0siQPXCf6KoQTG7Vzcuq5em8AUq7O8DNtCq txZvN0hJY+b62GVQznbHs+rRWQ6/uNMDxUVEKqZsxztkH6A17dWRlYqgSa7eEduBLBeY cONf6deQG/1kf8/T/4ufHivBNCNy8OkAjLZcmALH5md8lq1X7sP71sEFMlO80TA1a8se Qrcw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gn22si3048007plb.19.2019.02.05.03.56.50; Tue, 05 Feb 2019 03:57:06 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728033AbfBEL4Q (ORCPT + 99 others); Tue, 5 Feb 2019 06:56:16 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:56404 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725947AbfBEL4P (ORCPT ); Tue, 5 Feb 2019 06:56:15 -0500 Received: from 79.184.254.36.ipv4.supernova.orange.pl (79.184.254.36) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.183) id 591d23d00c9b99f8; Tue, 5 Feb 2019 12:56:13 +0100 From: "Rafael J. Wysocki" To: Harry Pan Cc: LKML , gs0622@gmail.com, pavel@ucw.cz, len.brown@intel.com, linux-pm@vger.kernel.org Subject: Re: [PATCH] PM / suspend: measure the time of filesystem syncing Date: Tue, 05 Feb 2019 12:55:01 +0100 Message-ID: <1702604.tyfAVjpQ0o@aspire.rjw.lan> In-Reply-To: <20190203052007.27392-1-harry.pan@intel.com> References: <20190203052007.27392-1-harry.pan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sunday, February 3, 2019 6:20:07 AM CET Harry Pan wrote: > 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; Why do you need three vars here? One should be sufficient. > + 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(); Why _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 > >