From patchwork Thu Sep 18 23:27:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 37628 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 926C92054D for ; Thu, 18 Sep 2014 23:27:27 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id l4sf1061363lbv.0 for ; Thu, 18 Sep 2014 16:27:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=m0UgQnj4QFrxJSFJdZY3mBE9P5tqxWlI0pi3RS6FOvE=; b=lCbrxkpUZk7RjJubvQXrozMrFMwDt/JlGzllPFYIcTF3Rt8/cKYQgTAEAeftdnn3bY DXL6vsukqqlFOmT62UuII/pvy9VnsoxZSIkXSMxbm0t1ItrfeiKhe8Qgdu71ciw0HVYD +v4PbEOSxfVlX28QQOSwCRFt3o03bnRR7XCXYt0mHgeYdpJoh/F2HHYsT62bnKCm/lUk B3gMwc9hqFJgHnV2Hh5yAJIHdXhqEUTpgzXk6Aaz5DvbnBpxbKPD55TXU5GSyarFtjNT efpyvuT+LtCKgi2ey7b4mv0ukqcNGUTxCNMYXgHYuiPQFT3SUT173B4MHOdfRADeV2Qh m9Eg== X-Gm-Message-State: ALoCoQkHz0/ezXh9kmSocbe1BD00eKoAvArA/fUqZVXveG7G472Af0YQsUggVXEOkj+tZdUl8Dmp X-Received: by 10.180.10.137 with SMTP id i9mr3796249wib.0.1411082846290; Thu, 18 Sep 2014 16:27:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.134 with SMTP id b6ls278416lah.42.gmail; Thu, 18 Sep 2014 16:27:26 -0700 (PDT) X-Received: by 10.152.42.136 with SMTP id o8mr2720602lal.71.1411082845998; Thu, 18 Sep 2014 16:27:25 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx.google.com with ESMTPS id y2si230151lae.49.2014.09.18.16.27.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Sep 2014 16:27:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id ge10so2069367lab.41 for ; Thu, 18 Sep 2014 16:27:25 -0700 (PDT) X-Received: by 10.112.199.197 with SMTP id jm5mr2672838lbc.19.1411082845923; Thu, 18 Sep 2014 16:27:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp846391lbb; Thu, 18 Sep 2014 16:27:25 -0700 (PDT) X-Received: by 10.68.69.68 with SMTP id c4mr8571360pbu.163.1411082844418; Thu, 18 Sep 2014 16:27:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hr10si253888pad.51.2014.09.18.16.27.23 for ; Thu, 18 Sep 2014 16:27:24 -0700 (PDT) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754489AbaIRX1W (ORCPT + 15 others); Thu, 18 Sep 2014 19:27:22 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:41103 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752533AbaIRX1V (ORCPT ); Thu, 18 Sep 2014 19:27:21 -0400 Received: by mail-pa0-f48.google.com with SMTP id fb1so1637071pad.7 for ; Thu, 18 Sep 2014 16:27:21 -0700 (PDT) X-Received: by 10.70.138.9 with SMTP id qm9mr10541931pdb.131.1411082841417; Thu, 18 Sep 2014 16:27:21 -0700 (PDT) Received: from flying-dutchman.swisscom.com (70-35-38-154.static.wiline.com. [70.35.38.154]) by mx.google.com with ESMTPSA id yh3sm112901pbb.38.2014.09.18.16.27.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Sep 2014 16:27:20 -0700 (PDT) From: Amit Pundir To: linux-kernel@vger.kernel.org Cc: Todd Poynor , Pavel Machek , Thomas Gleixner , "Rafael J. Wysocki" , Len Brown , linux-pm@vger.kernel.org, Android Kernel Team , Amit Pundir Subject: [PATCH v2] PM: Print wall time at suspend entry and exit Date: Fri, 19 Sep 2014 04:57:12 +0530 Message-Id: <1411082832-4713-1-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: amit.pundir@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Todd Poynor Existing timestamps in a dmesg only log suspend activities (e.g. filesystem syncs, freezing/unfreezing tasks etc) while the system has already started to enter/exit the suspend state. Sometimes it is handy to have suspend entry/exit overhead information while debugging suspend issues. This patch print markers with wall timestamps at suspend Entry and Exit in the kernel log. These timestamps can be used to compute how long the system spent in low-power suspend state plus the entry/exit overhead. Cc: Pavel Machek Cc: Thomas Gleixner Cc: Rafael J. Wysocki Cc: Len Brown Cc: linux-pm@vger.kernel.org Cc: Android Kernel Team Signed-off-by: Todd Poynor [Amit Pundir: Reworded the commit message] Signed-off-by: Amit Pundir --- Resending this patch assuming that it might have got lost in between merge window rush last time and now people might have some time to look at it. kernel/power/suspend.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 18c6219..5390c6c 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -443,6 +444,18 @@ static int enter_state(suspend_state_t state) return error; } +static void pm_suspend_marker(char *annotation) +{ + struct timespec ts; + struct rtc_time tm; + + getnstimeofday(&ts); + rtc_time_to_tm(ts.tv_sec, &tm); + pr_info("PM: suspend %s %d-%02d-%02d %02d:%02d:%02d.%09lu UTC\n", + annotation, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec); +} + /** * pm_suspend - Externally visible function for suspending the system. * @state: System sleep state to enter. @@ -457,6 +470,7 @@ int pm_suspend(suspend_state_t state) if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX) return -EINVAL; + pm_suspend_marker("entry"); error = enter_state(state); if (error) { suspend_stats.fail++; @@ -464,6 +478,7 @@ int pm_suspend(suspend_state_t state) } else { suspend_stats.success++; } + pm_suspend_marker("exit"); return error; } EXPORT_SYMBOL(pm_suspend);