svn commit: r288043 - head/usr.bin/ctlstat

Alexander Motin mav at FreeBSD.org
Sun Sep 20 21:06:38 UTC 2015


Author: mav
Date: Sun Sep 20 21:06:37 2015
New Revision: 288043
URL: https://svnweb.freebsd.org/changeset/base/288043

Log:
  Output times as normal microseconds, rather then in bintime format.

Modified:
  head/usr.bin/ctlstat/ctlstat.c

Modified: head/usr.bin/ctlstat/ctlstat.c
==============================================================================
--- head/usr.bin/ctlstat/ctlstat.c	Sun Sep 20 20:55:00 2015	(r288042)
+++ head/usr.bin/ctlstat/ctlstat.c	Sun Sep 20 21:06:37 2015	(r288043)
@@ -326,8 +326,8 @@ compute_stats(struct ctl_lun_io_stats *c
  */
 
 #define	PRINT_BINTIME(prefix, bt) \
-	printf("%s %jd s %ju frac\n", prefix, (intmax_t)(bt).sec, \
-	       (uintmax_t)(bt).frac)
+	printf("%s %jd.%06ju\n", prefix, (intmax_t)(bt).sec, \
+	       (uintmax_t)(((bt).frac >> 32) * 1000000 >> 32))
 static const char *iotypes[] = {"NO IO", "READ", "WRITE"};
 
 static void
@@ -360,9 +360,8 @@ ctlstat_dump(struct ctlstat_context *ctx
 }
 
 #define	JSON_BINTIME(prefix, bt) \
-	printf("\"%s\":{\"sec\":%jd,\"frac\":%ju},", \
-	    prefix, (intmax_t)(bt).sec, (uintmax_t)(bt).frac)
-
+	printf("\"%s\":%jd.%06ju,", prefix, (intmax_t)(bt).sec, \
+	    (uintmax_t)(((bt).frac >> 32) * 1000000 >> 32))
 static void
 ctlstat_json(struct ctlstat_context *ctx) {
 	int iotype, lun, port;


More information about the svn-src-head mailing list