]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
console: Traditional console timestamps including milliseconds
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 13 Mar 2014 13:38:37 +0000 (14:38 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 13 Mar 2014 13:38:37 +0000 (14:38 +0100)
Suggested-by: Don Slutz <dslutz@verizon.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
docs/misc/xen-command-line.markdown
xen/arch/arm/time.c
xen/arch/x86/time.c
xen/drivers/char/console.c
xen/include/xen/time.h

index 80a0a5598e7f9588d3eee08dfa50bcb4c0c7067e..689ffe69d5f4b6ae3871675fc63239009f5dbce3 100644 (file)
@@ -275,7 +275,7 @@ cleared.  This allows a single port to be shared by two subsystems
 makes sense on its own.
 
 ### console\_timestamps
-> `= none | date | boot`
+> `= none | date | datems | boot`
 
 > Default: `none`
 
@@ -284,6 +284,8 @@ Specify which timestamp format Xen should use for each console line.
 * `none`: No timestamps
 * `date`: Date and time information
     * `[YYYY-MM-DD HH:MM:SS]`
+* `datems`: Date and time, with milliseconds
+    * `[YYYY-MM-DD HH:MM:SS.mmm]`
 * `boot`: Seconds and microseconds since boot
     * `[SSSSSS.uuuuuu]`
 
index 81e3e2889c42fe381bef602fce980a2cb82a1c37..22e94bbb0f3e8a7f2aaf037acc7a916165da4b85 100644 (file)
@@ -282,7 +282,7 @@ void domain_set_time_offset(struct domain *d, int32_t time_offset_seconds)
     /* XXX update guest visible wallclock time */
 }
 
-struct tm wallclock_time(void)
+struct tm wallclock_time(uint64_t *ns)
 {
     return (struct tm) { 0 };
 }
index 4f4de22f7eb849d8e5c85abb9284909c565b12ea..f904af2011338022d7e1ef8a43b32d989974aeb0 100644 (file)
@@ -1646,15 +1646,19 @@ int dom0_pit_access(struct ioreq *ioreq)
     return 0;
 }
 
-struct tm wallclock_time(void)
+struct tm wallclock_time(uint64_t *ns)
 {
-    uint64_t seconds;
+    uint64_t seconds, nsec;
 
     if ( !wc_sec )
         return (struct tm) { 0 };
 
     seconds = NOW() + SECONDS(wc_sec) + wc_nsec;
-    do_div(seconds, 1000000000);
+    nsec = do_div(seconds, 1000000000);
+
+    if ( ns )
+        *ns = nsec;
+
     return gmtime(seconds);
 }
 
index 9c032bf3e2f886859b6036573e2e5184b0ed1d17..7fa9b789ced3be35bf9d23f4a60e26b7dd680e96 100644 (file)
@@ -53,6 +53,7 @@ enum con_timestamp_mode
 {
     TSM_NONE,          /* No timestamps */
     TSM_DATE,          /* [YYYY-MM-DD HH:MM:SS] */
+    TSM_DATE_MS,       /* [YYYY-MM-DD HH:MM:SS.mmm] */
     TSM_BOOT           /* [SSSSSS.uuuuuu] */
 };
 
@@ -560,6 +561,8 @@ static void __init parse_console_timestamps(char *s)
     if ( *s == '\0' || /* Compat for old booleanparam() */
          !strcmp(s, "date") )
         opt_con_timestamp_mode = TSM_DATE;
+    else if ( !strcmp(s, "datems") )
+        opt_con_timestamp_mode = TSM_DATE_MS;
     else if ( !strcmp(s, "boot") )
         opt_con_timestamp_mode = TSM_BOOT;
     else if ( !strcmp(s, "none") )
@@ -577,7 +580,8 @@ static void printk_start_of_line(const char *prefix)
     switch ( opt_con_timestamp_mode )
     {
     case TSM_DATE:
-        tm = wallclock_time();
+    case TSM_DATE_MS:
+        tm = wallclock_time(&nsec);
 
         if ( tm.tm_mday == 0 )
             return;
@@ -586,6 +590,11 @@ static void printk_start_of_line(const char *prefix)
             snprintf(tstr, sizeof(tstr), "[%04u-%02u-%02u %02u:%02u:%02u] ",
                      1900 + tm.tm_year, tm.tm_mon + 1, tm.tm_mday,
                      tm.tm_hour, tm.tm_min, tm.tm_sec);
+        else
+            snprintf(tstr, sizeof(tstr),
+                     "[%04u-%02u-%02u %02u:%02u:%02u.%03"PRIu64"] ",
+                     1900 + tm.tm_year, tm.tm_mon + 1, tm.tm_mday,
+                     tm.tm_hour, tm.tm_min, tm.tm_sec, nsec / 1000000);
         break;
 
     case TSM_BOOT:
index 3eb5b63b5c86255b687b4814e272c3386b41a27a..27034544c9b90f31230800c1874589f3fa96c3f4 100644 (file)
@@ -48,7 +48,7 @@ struct tm {
     int     tm_isdst;       /* daylight saving time */
 };
 struct tm gmtime(unsigned long t);
-struct tm wallclock_time(void);
+struct tm wallclock_time(uint64_t *ns);
 
 #define SYSTEM_TIME_HZ  1000000000ULL
 #define NOW()           ((s_time_t)get_s_time())