svn commit: r288783 - stable/10/usr.bin/ctlstat

Alexander Motin mav at FreeBSD.org
Mon Oct 5 10:48:15 UTC 2015


Author: mav
Date: Mon Oct  5 10:48:14 2015
New Revision: 288783
URL: https://svnweb.freebsd.org/changeset/base/288783

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

Modified:
  stable/10/usr.bin/ctlstat/ctlstat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/ctlstat/ctlstat.c
==============================================================================
--- stable/10/usr.bin/ctlstat/ctlstat.c	Mon Oct  5 10:47:18 2015	(r288782)
+++ stable/10/usr.bin/ctlstat/ctlstat.c	Mon Oct  5 10:48:14 2015	(r288783)
@@ -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-all mailing list