Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Sep 2015 21:06:38 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288043 - head/usr.bin/ctlstat
Message-ID:  <201509202106.t8KL6cfJ004575@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509202106.t8KL6cfJ004575>