From patchwork Wed Jul 19 19:50:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salyzyn X-Patchwork-Id: 9853175 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 764D7602BD for ; Wed, 19 Jul 2017 19:50:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75C62286F4 for ; Wed, 19 Jul 2017 19:50:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74421286FC; Wed, 19 Jul 2017 19:50:42 +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.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable 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 CE0722861F for ; Wed, 19 Jul 2017 19:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754287AbdGSTu3 (ORCPT ); Wed, 19 Jul 2017 15:50:29 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:36458 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753297AbdGSTuY (ORCPT ); Wed, 19 Jul 2017 15:50:24 -0400 Received: by mail-pg0-f42.google.com with SMTP id 125so4476421pgi.3 for ; Wed, 19 Jul 2017 12:50:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ppMg4pQF2BMDNupTCgTmRv6WZvOsb0aI+I4P2WfPk7k=; b=Zu0f5FE2DGvgrUH61pFAfd2K6H1D5PksckK0qwICa7qJ2f24J1lDfEMraUiK7gQLki 6wq0E1fJh/MWVbjkUWgc17fchH1Lxr7ZY0ZNTlRU0+t4nVWK8W6hD0JB+xK2UsZHO/LS 2jJab/sU3/LgEyR68h+GpVhkaWfZh9Phyd9Z9sf2VKk2avOcumRY/atrBneYaXSnPvmo s2Saldrk2UpalYz92oKWw+HeC99+/BhvY3h7Vq+ZDx1ciUx8GQumUsOR4T14gc5H8c89 vE/Oxclu8z1IJZQ1p+a9dKsq+3JMGHb/uFk90Y8orUBo2krTFJN5YkZLwBJDOm4WUciV YS7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ppMg4pQF2BMDNupTCgTmRv6WZvOsb0aI+I4P2WfPk7k=; b=X2CP+WW/xeaqF+lVlF7401hH/vqc+GFqAy3PrdyivonYvcQW/m85sSJfjyEILMdIJ3 5K58+/ovmy9CIbvWJtvQMvnk/lknYgrtxIDWV7r3hx02+PTRj3OLhAgYXgsS95E0w0rl 8esNIg9r75gLDbsNtTFcV4D74kuQzAknn4POpgJfCqdJmL50Ofp+M9mwNQ5/rMpuZ9xj FVmWgt94rHb2bwDi4QerQe93Y09+TaR55DMPhUsNfROik0bQEhTZuhxBI6PDyKaoV70c bFngQCwpeSavhPXwmir41eoOMve8SW6ud4IHVsMYDcTMLxg8TuQoDcFk7lvAKeGUzBIb NkzQ== X-Gm-Message-State: AIVw113hMRQbC0eJj7T/LcCLjk0S/l26Yfe0oGcqHsmct+CpEObC8/uG ZRUZx1+sJies+Etu X-Received: by 10.98.209.83 with SMTP id t19mr1180229pfl.311.1500493823681; Wed, 19 Jul 2017 12:50:23 -0700 (PDT) Received: from nebulus.mtv.corp.google.com ([100.98.120.17]) by smtp.gmail.com with ESMTPSA id p16sm958508pgc.93.2017.07.19.12.50.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Jul 2017 12:50:23 -0700 (PDT) From: Mark Salyzyn To: linux-kernel@vger.kernel.org Cc: rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz, linux-pm@vger.kernel.org, a.zummo@towertech.it, alexandre.belloni@free-electrons.com, linux-rtc@vger.kernel.org, prarit@redhat.com, andy.shevchenko@gmail.com, Mark Salyzyn , "Paul E. McKenney" Subject: [PATCH 4/4] time: rtc-lib: Add CONFIG_RTC_SHOW_TIME_RTC Date: Wed, 19 Jul 2017 12:50:03 -0700 Message-Id: <20170719195012.30187-1-salyzyn@android.com> X-Mailer: git-send-email 2.14.0.rc0.284.gd933b75aa4-goog 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 Add an option to report REALTIME in RTC time format for rtc_show_time() function. Feature activated by CONFIG_RTC_SHOW_TIME_RTC. Signed-off-by: Mark Salyzyn --- kernel/time/Kconfig | 17 +++++++++++++++++ kernel/time/rtc_show_time.c | 12 ++++++++++++ 2 files changed, 29 insertions(+) diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig index 2dc891056635..3c2920b8825c 100644 --- a/kernel/time/Kconfig +++ b/kernel/time/Kconfig @@ -221,4 +221,21 @@ choice continues, and the timestamps help re-orient post-analysis. Print boottime . timestamp in rtc_show_time + config RTC_SHOW_TIME_RTC + bool "realtime in wall clock format" + select RTC_SHOW_TIME + select RTC_LIB + help + Activate optional rtc_show_time(const char *msg) wall clock + time instrumentation. + + The primary use of the instrumentation is to aid field + analysis of Battery and Power usage. The instrumentation + may also help triage and synchronize kernel logs and user + space activity logs at key displacements. For instance + CLOCK_MONOTONIC stops while suspended, while CLOCK_REALTIME + continues, and the timestamps help re-orient post-analysis. + + Print realtime YYYY-MM-DD hh:mm:ss. timestamp in + rtc_show_time. endchoice diff --git a/kernel/time/rtc_show_time.c b/kernel/time/rtc_show_time.c index 6c7b8ae6be0c..d861a30aef77 100644 --- a/kernel/time/rtc_show_time.c +++ b/kernel/time/rtc_show_time.c @@ -24,9 +24,21 @@ void rtc_show_time(const char *prefix_msg) struct timespec64 ts; getnstimeofday64(&ts); +#if defined(CONFIG_RTC_SHOW_TIME_RTC) + { + struct rtc_time tm; + + rtc_time64_to_tm(ts.tv_sec, &tm); + pr_info("%s %d-%02d-%02d %02d:%02d:%02d.%09lu UTC\n", + prefix_msg ? prefix_msg : "Time:", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec); + } +#else pr_info("%s %lu.%09lu UTC\n", prefix_msg ? prefix_msg : "Time:", ts.tv_sec, ts.tv_nsec); #endif +#endif } EXPORT_SYMBOL(rtc_show_time);