From: Mark Salyzyn <salyzyn@android.com>
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 <salyzyn@android.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH 4/4] time: rtc-lib: Add CONFIG_RTC_SHOW_TIME_RTC
Date: Wed, 19 Jul 2017 12:50:03 -0700 [thread overview]
Message-ID: <20170719195012.30187-1-salyzyn@android.com> (raw)
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 <salyzyn@android.com>
---
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 <s>.<ns> 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.<ns> 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);
--
2.14.0.rc0.284.gd933b75aa4-goog
next reply other threads:[~2017-07-19 19:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 19:50 Mark Salyzyn [this message]
2017-07-20 8:26 ` [PATCH 4/4] time: rtc-lib: Add CONFIG_RTC_SHOW_TIME_RTC Pavel Machek
2017-07-20 17:52 ` Mark Salyzyn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170719195012.30187-1-salyzyn@android.com \
--to=salyzyn@android.com \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@free-electrons.com \
--cc=andy.shevchenko@gmail.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=pavel@ucw.cz \
--cc=prarit@redhat.com \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).