--- old/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs	Thu Jan 28 18:01:10 2016
+++ new/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs	Thu Jan 28 18:01:10 2016
@@ -22,6 +22,7 @@
 /*
  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014 Racktop Systems.
+ * Copyright 2016 Garrett D'Amore
  */
 
 /*
@@ -1074,6 +1075,9 @@
 		case KSTAT_DATA_UINT64:
 			value = NEW_UV(knp->value.ui64);
 			break;
+		case KSTAT_DATA_TIME:
+			value = NEW_HRTIME(knp->value.ui64);
+			break;
 		case KSTAT_DATA_STRING:
 			if (KSTAT_NAMED_STR_PTR(knp) == NULL)
 				value = newSVpv("null", sizeof ("null") - 1);
--- old/usr/src/cmd/stat/kstat/kstat.c	Thu Jan 28 18:01:11 2016
+++ new/usr/src/cmd/stat/kstat/kstat.c	Thu Jan 28 18:01:11 2016
@@ -24,6 +24,7 @@
  * Copyright (c) 2013 David Hoeppner. All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright 2016 Garrett D'Amore
  */
 
 /*
@@ -39,6 +40,12 @@
  *	-C	similar to the -p option but value is separated by a colon
  *	-h	display help
  *	-j	json format
+ *	-H b	display hrtime as seconds since boot
+ *	-H d	display hrtime as date
+ *	-H u	display hrtime as UNIX seconds (since epoch)
+ *	-H I	display hrtime as ISO-8601 local time
+ *	-H Z	display hrtime as ISO-8601 UTC
+ *	-H n	display hrtime as nanoseconds (since epoch)
  */
 
 #include <assert.h>
@@ -68,6 +75,7 @@
 int	caught_cont = 0;	/* Have caught a SIGCONT */
 
 static uint_t	g_timestamp_fmt = NODATE;
+static uint_t	g_hrtime_fmt = KS_HRFMT_DEFAULT;
 
 /* Helper flag - header was printed already? */
 static boolean_t g_headerflg;
@@ -87,6 +95,8 @@
 static list_t	instances_list;
 static list_t	selector_list;
 
+static hrtime_t	hrtime_origin;
+
 int
 main(int argc, char **argv)
 {
@@ -124,7 +134,7 @@
 	/*
 	 * Parse named command line arguments.
 	 */
-	while ((c = getopt(argc, argv, "h?CqjlpT:m:i:n:s:c:")) != EOF)
+	while ((c = getopt(argc, argv, "h?CqjlpT:m:i:n:s:c:H:")) != EOF)
 		switch (c) {
 		case 'h':
 		case '?':
@@ -147,6 +157,9 @@
 			g_pflg = B_TRUE;
 			break;
 		case 'T':
+			if (strlen(optarg) != 1) {
+				errflg = B_TRUE;
+			}
 			switch (*optarg) {
 			case 'd':
 				g_timestamp_fmt = DDATE;
@@ -182,6 +195,25 @@
 			g_ks_class.pstr =
 			    (char *)ks_safe_strdup(optarg);
 			break;
+		case 'H':
+			switch (*optarg) {
+			case 'o':
+			case 'b':
+			case 'n':
+			case 'I':
+			case 'Z':
+			case 'd':
+			case 'u':
+				if (strlen(optarg) != 1) {
+					errflg = B_TRUE;
+				}
+				g_hrtime_fmt = *optarg;
+				break;
+			default:
+				errflg = B_TRUE;
+				break;
+			}
+			break;
 		default:
 			errflg = B_TRUE;
 			break;
@@ -193,6 +225,23 @@
 		errflg = B_TRUE;
 	}
 
+	switch (g_hrtime_fmt) {
+	case KS_HRFMT_DEFAULT:
+	case KS_HRFMT_BOOT:
+		break;
+	default: {
+		struct timespec ts;
+		if (clock_gettime(CLOCK_REALTIME, &ts) != 0) {
+			perror("clock_gettime(CLOCK_REALTIME)");
+			exit(3);
+		}
+		hrtime_origin = ts.tv_sec;
+		hrtime_origin *= 1000000000;
+		hrtime_origin += ts.tv_nsec;
+		hrtime_origin -= gethrtime();
+	}
+	}
+
 	if (errflg) {
 		usage();
 		exit(2);
@@ -352,10 +401,10 @@
 {
 	(void) fprintf(stderr, gettext(
 	    "Usage:\n"
-	    "kstat [ -Cjlpq ] [ -T d|u ] [ -c class ]\n"
+	    "kstat [ -Cjlpq ] [ -T d|u ] [ -H d|n|u|I|Z ] [ -c class ]\n"
 	    "      [ -m module ] [ -i instance ] [ -n name ] [ -s statistic ]\n"
 	    "      [ interval [ count ] ]\n"
-	    "kstat [ -Cjlpq ] [ -T d|u ] [ -c class ]\n"
+	    "kstat [ -Cjlpq ] [ -T d|u ] [ -c class ] [ -H d|n|u|I|Z ]\n"
 	    "      [ module[:instance[:name[:statistic]]] ... ]\n"
 	    "      [ interval [ count ] ]\n"));
 }
@@ -708,6 +757,10 @@
 static void
 ks_value_print(ks_nvpair_t *nvpair)
 {
+	char dstr[64];
+	char zstr[8];
+	time_t t;
+
 	switch (nvpair->data_type) {
 	case KSTAT_DATA_CHAR:
 		(void) fprintf(stdout, "%s", nvpair->value.c);
@@ -727,12 +780,53 @@
 	case KSTAT_DATA_STRING:
 		(void) fprintf(stdout, "%s", KSTAT_NAMED_STR_PTR(nvpair));
 		break;
-	case KSTAT_DATA_HRTIME:
-		if (nvpair->value.ui64 == 0)
-			(void) fprintf(stdout, "0");
-		else
+	case KSTAT_DATA_TIME:
+		switch (g_hrtime_fmt) {
+		case KS_HRFMT_UNIX:
 			(void) fprintf(stdout, "%.9f",
-			    nvpair->value.ui64 / 1000000000.0);
+			    (nvpair->value.t + hrtime_origin) / 1000000000.0);
+			break;
+		case KS_HRFMT_NANO:
+			(void) fprintf(stdout, "%llu",
+			    (nvpair->value.t + hrtime_origin));
+			break;
+		case KS_HRFMT_DATE:
+			t = (time_t)
+			    ((nvpair->value.t + hrtime_origin) / 1000000000);
+			(void) strftime(dstr,
+			    sizeof (dstr), "%+", localtime(&t));
+			(void) fprintf(stdout, "%s", dstr);
+			break;
+		case KS_HRFMT_ZISO:
+			t = (time_t)
+			    ((nvpair->value.t + hrtime_origin) / 1000000000);
+			(void) strftime(dstr, sizeof (dstr), "%FT%T",
+			    gmtime(&t));
+			(void) fprintf(stdout, "%s.%06uZ", dstr,
+			    (unsigned)(nvpair->value.t % 1000000000)/1000);
+			break;
+		case KS_HRFMT_ISO:
+			t = (time_t)
+			    ((nvpair->value.t + hrtime_origin) / 1000000000);
+			(void) strftime(dstr, sizeof (dstr), "%FT%T",
+			    localtime(&t));
+			(void) strftime(zstr, sizeof (zstr), "%z",
+			    localtime(&t));
+			(void) fprintf(stdout, "%s.%06u%s", dstr,
+			    (unsigned)(nvpair->value.t % 1000000000)/1000,
+			    zstr);
+			break;
+		case KS_HRFMT_DEFAULT:
+		case KS_HRFMT_BOOT:
+			if (nvpair->value.ui64 == 0)
+				(void) fprintf(stdout, "0");
+			else
+				(void) fprintf(stdout, "%.9f",
+				    nvpair->value.ui64 / 1000000000.0);
+			break;
+		default:
+			abort();
+		}
 		break;
 	default:
 		assert(B_FALSE);
@@ -798,6 +892,18 @@
 		(void) putchar('\"');
 		ks_value_print(nvpair);
 		(void) putchar('\"');
+	} else if (nvpair->data_type == KSTAT_DATA_TIME) {
+		switch (g_hrtime_fmt) {
+		case KS_HRFMT_ISO:
+		case KS_HRFMT_ZISO:
+		case KS_HRFMT_DATE:
+			(void) putchar('\"');
+			ks_value_print(nvpair);
+			(void) putchar('\"');
+			break;
+		default:
+			ks_value_print(nvpair);
+		}
 	} else {
 		ks_value_print(nvpair);
 	}
@@ -1388,24 +1494,13 @@
 	for (n = kp->ks_ndata, knp = KSTAT_NAMED_PTR(kp); n > 0; n--, knp++) {
 		switch (knp->data_type) {
 		case KSTAT_DATA_CHAR:
-			nvpair_insert(ksi, knp->name,
-			    (ks_value_t *)&knp->value, KSTAT_DATA_CHAR);
-			break;
 		case KSTAT_DATA_INT32:
-			nvpair_insert(ksi, knp->name,
-			    (ks_value_t *)&knp->value, KSTAT_DATA_INT32);
-			break;
 		case KSTAT_DATA_UINT32:
-			nvpair_insert(ksi, knp->name,
-			    (ks_value_t *)&knp->value, KSTAT_DATA_UINT32);
-			break;
 		case KSTAT_DATA_INT64:
-			nvpair_insert(ksi, knp->name,
-			    (ks_value_t *)&knp->value, KSTAT_DATA_INT64);
-			break;
 		case KSTAT_DATA_UINT64:
+		case KSTAT_DATA_TIME:
 			nvpair_insert(ksi, knp->name,
-			    (ks_value_t *)&knp->value, KSTAT_DATA_UINT64);
+			    (ks_value_t *)&knp->value, knp->data_type);
 			break;
 		case KSTAT_DATA_STRING:
 			SAVE_STRING_X(ksi, knp->name, KSTAT_NAMED_STR_PTR(knp));
@@ -1438,11 +1533,11 @@
 	SAVE_UINT64(ksi, ksio, nwritten);
 	SAVE_UINT32(ksi, ksio, reads);
 	SAVE_UINT32(ksi, ksio, writes);
-	SAVE_HRTIME(ksi, ksio, wtime);
-	SAVE_HRTIME(ksi, ksio, wlentime);
+	SAVE_UINT64(ksi, ksio, wtime);
+	SAVE_UINT64(ksi, ksio, wlentime);
 	SAVE_HRTIME(ksi, ksio, wlastupdate);
-	SAVE_HRTIME(ksi, ksio, rtime);
-	SAVE_HRTIME(ksi, ksio, rlentime);
+	SAVE_UINT64(ksi, ksio, rtime);
+	SAVE_UINT64(ksi, ksio, rlentime);
 	SAVE_HRTIME(ksi, ksio, rlastupdate);
 	SAVE_UINT32(ksi, ksio, wcnt);
 	SAVE_UINT32(ksi, ksio, rcnt);
@@ -1455,9 +1550,9 @@
 
 	SAVE_STRING(ksi, ktimer, name);
 	SAVE_UINT64(ksi, ktimer, num_events);
-	SAVE_HRTIME(ksi, ktimer, elapsed_time);
-	SAVE_HRTIME(ksi, ktimer, min_time);
-	SAVE_HRTIME(ksi, ktimer, max_time);
+	SAVE_UINT64(ksi, ktimer, elapsed_time);
+	SAVE_UINT64(ksi, ktimer, min_time);
+	SAVE_UINT64(ksi, ktimer, max_time);
 	SAVE_HRTIME(ksi, ktimer, start_time);
 	SAVE_HRTIME(ksi, ktimer, stop_time);
 }
--- old/usr/src/cmd/stat/kstat/kstat.h	Thu Jan 28 18:01:11 2016
+++ new/usr/src/cmd/stat/kstat/kstat.h	Thu Jan 28 18:01:11 2016
@@ -22,6 +22,7 @@
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Copyright 2013 David Hoeppner.  All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2016 Garrett D'Amore
  */
 
 #ifndef _STAT_KSTAT_H
@@ -46,8 +47,6 @@
 #include <sys/fhc.h>
 #endif
 
-#define	KSTAT_DATA_HRTIME	(KSTAT_DATA_STRING + 1)
-
 typedef union ks_value {
 	char		c[16];
 	int32_t		i32;
@@ -62,13 +61,18 @@
 
 	int64_t		i64;
 	uint64_t	ui64;
+	hrtime_t	t;
 } ks_value_t;
 
-#define	SAVE_HRTIME(I, S, N)				\
-{							\
-	ks_value_t v;					\
-	v.ui64 = S->N;					\
-	nvpair_insert(I, #N, &v, KSTAT_DATA_UINT64);	\
+#define	SAVE_HRTIME(I, S, N)					\
+{								\
+	ks_value_t v;						\
+	v.ui64 = S->N;						\
+	if (g_hrtime_fmt == KS_HRFMT_DEFAULT) {			\
+		nvpair_insert(I, #N, &v, KSTAT_DATA_UINT64);	\
+	} else {						\
+		nvpair_insert(I, #N, &v, KSTAT_DATA_TIME);	\
+	}							\
 }
 
 #define	SAVE_INT32(I, S, N)				\
@@ -115,7 +119,7 @@
 {							\
 	ks_value_t v;					\
 	v.ui64 = V;					\
-	nvpair_insert(I, N, &v, KSTAT_DATA_HRTIME);	\
+	nvpair_insert(I, N, &v, KSTAT_DATA_TIME);	\
 }
 
 #define	SAVE_INT32_X(I, N, V)				\
@@ -170,6 +174,14 @@
 #define	KS_JFMT	"\t\t\"%s\": "
 #define	KS_PFMT	"%s:%d:%s:%s"
 
+#define	KS_HRFMT_DEFAULT	'o'
+#define	KS_HRFMT_BOOT		'b'
+#define	KS_HRFMT_UNIX		'u'
+#define	KS_HRFMT_DATE		'd'
+#define	KS_HRFMT_NANO		'n'
+#define	KS_HRFMT_ISO		'I'
+#define	KS_HRFMT_ZISO		'Z'
+
 typedef struct ks_instance {
 	list_node_t	ks_next;
 	char		ks_name[KSTAT_STRLEN];
--- old/usr/src/man/man1m/kstat.1m	Thu Jan 28 18:01:11 2016
+++ new/usr/src/man/man1m/kstat.1m	Thu Jan 28 18:01:11 2016
@@ -1,182 +1,155 @@
-'\" te
+.\" Copyright 2016 Garrett D'Amore
 .\" Copyright (c) 2000, Sun Microsystems, Inc. All Rights Reserved
-.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
-.\"  See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with
-.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH KSTAT 1M "Jan 9, 2013"
-.SH NAME
-kstat \- display kernel statistics
-.SH SYNOPSIS
-.LP
-.nf
-\fBkstat\fR [\fB-Cjlpq\fR] [\fB-T\fR u | d ] [\fB-c\fR \fIclass\fR] [\fB-m\fR \fImodule\fR]
-     [\fB-i\fR \fIinstance\fR] [\fB-n\fR \fIname\fR] [\fB-s\fR \fIstatistic\fR]
-     [interval [count]]
-.fi
-
-.LP
-.nf
-\fBkstat\fR [\fB-Cjlpq\fR] [\fB-T\fR u | d ] [\fB-c\fR \fIclass\fR]
-     [\fImodule\fR[:\fIinstance\fR[:\fIname\fR[:\fIstatistic\fR]]]]...
-     [interval [count]]
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-The \fBkstat\fR utility examines the available kernel statistics, or kstats, on
+.\" The contents of this file are subject to the terms of the Common
+.\" Development and Distribution License (the "License").  You may not use this
+.\" file except in compliance with the License. You can obtain a copy of the
+.\" license at usr/src/OPENSOLARIS.LICENSE or
+.\" http://www.opensolaris.org/os/licensing.
+.\"
+.\" See the License for the specific language governing permissions and
+.\" limitations under the License. When distributing Covered Code, include this
+.\" CDDL HEADER in each file and include the License file at
+.\" usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this
+.\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your
+.\" own identifying information: Portions Copyright [yyyy] [name of copyright
+.\" owner]
+.\"
+.Dd Jan 27, 2016
+.Dt KSTAT 1M
+.Os
+.Sh NAME
+.Nm kstat
+.Nd display kernel statistics
+.Sh SYNOPSIS
+.Nm
+.Op Fl Cjlpq
+.Op Fl T Cm "u|d"
+.Op Fl c Ar class
+.Op Fl m Ar module
+.Op Fl i Ar instance
+.Op Fl n Ar name
+.Op Fl s Ar statistic
+.Op Fl H Cm "o|b|u|d|n|I|Z"
+.Op interval Op count
+.Nm
+.Op Fl Cjlpq
+.Op Fl T Cm "u|d"
+.Op Fl c Ar class
+.Op Fl H Cm "o|b|u|d|n|I|Z"
+.Op Ar module Ns Op ":" Ns Ar instance Ns Op ":" Ns Ar name Ns Op ":" Ns Ar statistic
+.Ar ...
+.Op interval Op count
+.
+.Sh DESCRIPTION
+The
+.Nm
+utility examines the available kernel statistics, or kstats, on
 the system and reports those statistics which match the criteria specified on
 the command line. Each matching statistic is printed with its module, instance,
 and name fields, as well as its actual value.
-.sp
-.LP
+.Lp
 Kernel statistics may be published by various kernel subsystems, such as
 drivers or loadable modules; each kstat has a module field that denotes its
 publisher. Since each module might have countable entities (such as multiple
-disks associated with the \fBsd\fR(7D) driver) for which it wishes to report
+disks associated with the
+.Xr sd 7
+driver) for which it wishes to report
 statistics, the kstat also has an instance field to index the statistics for
 each entity; kstat instances are numbered starting from zero. Finally, the
 kstat is given a name unique within its module.
-.sp
-.LP
+.Lp
 Each kstat may be a special kstat type, an array of name-value pairs, or raw
 data. In the name-value case, each reported value is given a label, which we
 refer to as the statistic. Known raw and special kstats are given statistic
-labels for each of their values by \fBkstat\fR; thus, all published values can
-be referenced as \fImodule\fR:\fIinstance\fR:\fIname\fR:\fIstatistic\fR.
-.sp
-.LP
+labels for each of their values by
+.Va kstat ;
+thus, all published values can
+be referenced as
+.Ar module Ns : Ns Ar instance Ns : Ns Ar name Ns : Ns Ar statistic Ns .
+.Lp
 When invoked without any module operands or options, kstat will match all
-defined statistics on the system. Example invocations are provided below. All
-times are displayed as fractional seconds since system boot.
-.SH OPTIONS
-.sp
-.LP
+defined statistics on the system. Example invocations are provided below.
+.
+.Sh OPTIONS
+.
 The tests specified by the following options are logically ANDed, and all
 matching kstats will be selected. A regular expression containing shell
 metacharacters must be protected from the shell by enclosing it with the
 appropriate quotes.
-.sp
-.LP
-The argument for the \fB-c\fR, \fB-i\fR, \fB-m\fR, \fB-n\fR, and \fB-s\fR
+.Lp
+The argument for the
+.Fl c , i , m , n , No and Fl s
 options may be specified as a shell glob pattern, or a regular expression
 enclosed in '/' characters.
-.sp
-.ne 2
-.na
-\fB\fB-C\fR\fR
-.ad
-.RS 16n
+.
+.Bl -tag -width Ds
+.It Fl C
 Displays output in parseable format with a colon as separator.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-c\fR \fIclass\fR\fR
-.ad
-.RS 16n
-Displays only kstats that match the specified class. \fIclass\fR is a
-kernel-defined string which classifies the "type" of the kstat.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-i\fR \fIinstance\fR\fR
-.ad
-.RS 16n
+.It Fl H Cm o|b|u|d|n|I|Z
+Displays times in the specified format, after normalizing them.
+This can be any of the following:
+.Bl -tag -width Ds
+.It Sy o
+Displays snapshot and creation times as a fractional number of seconds
+since boot, and other times as a whole number of nanoseconds since boot.
+This the default behavior.
+.It Sy b
+Displays a fractional number of seconds since system boot.
+.It Sy u
+Displays a fractional number of seconds since the epoch (Jan 1, 1970 UTC).
+.It Sy d
+Displays in the same format as from
+.Xr date 1 .
+.It Sy n
+Displays a whole number of nanoseconds since the epoch.
+.It Sy I
+Displays an ISO 8601:2000 standard time format in the local timezone.
+.It Sy Z
+Displays an ISO 8601:2000 standard time format in UTC.
+.El
+.Lp
+Note that when using normalized time formats, the accuracy of
+the result will depend on the resolution of the realtime clock (see
+.Xr clock_gettime 3C ),
+and in no case will be more accurate to absolute time than one microsecond.
+However, any offset error between timestamps will be the same for all values
+displayed within a single kstat snapshot.
+.
+.It Fl c Ar class
+Displays only kstats that match the specified class.
+.Ar class
+is a kernel-defined string which classifies the "type" of the kstat.
+.It Fl i Ar instance
 Displays only kstats that match the specified instance.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-j\fR\fR
-.ad
-.RS 16n
+.It Fl j
 Displays output in JSON format.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-l\fR\fR
-.ad
-.RS 16n
+.It Fl l
 Lists matching kstat names without displaying values.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-m\fR \fImodule\fR\fR
-.ad
-.RS 16n
+.It Fl m Ar module
 Displays only kstats that match the specified module.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-n\fR \fIname\fR\fR
-.ad
-.RS 16n
+.It Fl n Ar name
 Displays only kstats that match the specified name.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-p\fR\fR
-.ad
-.RS 16n
+.It Fl p
 Displays output in parseable format. All example output in this document is
-given in this format. If this option is not specified, \fBkstat\fR produces
-output in a human-readable, table format.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-q\fR\fR
-.ad
-.RS 16n
+given in this format. If this option is not specified,
+.Nm
+produces output in a human-readable, table format.
+.It Fl q
 Displays no output, but return appropriate exit status for matches against
 given criteria.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-s\fR \fIstatistic\fR\fR
-.ad
-.RS 16n
+.It Fl s Ar statistic
 Displays only kstats that match the specified statistic.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-T\fR d | u\fR
-.ad
-.RS 16n
-Displays a time stamp before each statistics block, either in \fBdate\fR(1)
+.It Fl T Cm "d|u"
+Displays a time stamp before each statistics block, either in
+.Xr date 1
 format (\fBd\fR) or as an alphanumeric representation of the value returned by
-\fBtime\fR(2) (\fBu\fR).
-.RE
-
-.SH OPERANDS
-.sp
-.LP
+.Xr time 2
+(\fBu\fR).
+.El
+.Sh OPERANDS
 The following operands are supported:
-.sp
-.ne 2
-.na
-\fB\fImodule\fR:\fIinstance\fR:\fIname\fR:\fIstatistic\fR\fR
-.ad
-.sp .6
-.RS 4n
+.Bl -tag -width Ds
+.It Ar module Ns : Ns Ar instance Ns : Ns Ar name Ns : Ns Ar statistic Ns
 Alternate method of specifying module, instance, name, and statistic as
 described above. Each of the module, instance, name, or statistic specifiers
 may be a shell glob pattern or a regular expression enclosed by '/'
@@ -183,60 +156,52 @@
 characters. It is possible to use both specifier types within a single operand.
 Leaving a specifier empty is equivalent to using the '*' glob pattern for that
 specifier.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIinterval\fR\fR
-.ad
-.sp .6
-.RS 4n
+.It Ar interval
 The number of seconds between reports.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIcount\fR\fR
-.ad
-.sp .6
-.RS 4n
+.It Ar count
 The number of reports to be printed.
-.RE
-
-.SH EXAMPLES
-.sp
-.LP
+.El
+.Sh FILES
+.Bl -tag -width Ds
+.It Pa /dev/kstat
+kernel statistics driver
+.El
+.Sh EXIT STATUS
+The following exit values are returned:
+.Lp
+.Bl -tag -width Ds -compact
+.It 0
+One or more statistics were matched.
+.It 1
+No statistics were matched.
+.It 2
+Invalid command line options were specified.
+.It 3
+A fatal error occurred.
+.El
+.Sh EXAMPLES
 In the following examples, all the command lines in a block produce the same
 output, as shown immediately below. The exact statistics and values will of
 course vary from machine to machine.
-.LP
-\fBExample 1 \fRUsing the \fBkstat\fR Command
-.sp
-.in +2
-.nf
-example$ \fBkstat -p -m unix -i 0 -n system_misc -s 'avenrun*'\fR
+.
+.Ss Example 1: Using the kstat Command
+.Bd -literal -offset indent
+example$ \fBlstat -p -m unix -i 0 -n system_misc -s 'avenrun*'\fR
 example$ \fBkstat -p -s 'avenrun*'\fR
 example$ \fBkstat -p 'unix:0:system_misc:avenrun*'\fR
 example$ \fBkstat -p ':::avenrun*'\fR
 example$ \fBkstat -p ':::/^avenrun_[0-9]+min$/'\fR
-
+.sp
 unix:0:system_misc:avenrun_15min        3
 unix:0:system_misc:avenrun_1min 4
 unix:0:system_misc:avenrun_5min 2
-.fi
-.in -2
-.sp
-
-.LP
-\fBExample 2 \fRUsing the \fBkstat\fR Command
-.sp
-.in +2
-.nf
+.Ed
+.
+.Ss Example 2: Using the kstat Command
+.Bd -literal -offset indent
 example$ \fBkstat -p -m cpu_stat -s 'intr*'\fR
 example$ \fBkstat -p cpu_stat:::/^intr/\fR
-
+.sp
 cpu_stat:0:cpu_stat0:intr       29682330
 cpu_stat:0:cpu_stat0:intrblk    87
 cpu_stat:0:cpu_stat0:intrthread 15054222
@@ -249,18 +214,13 @@
 cpu_stat:3:cpu_stat3:intr       196566
 cpu_stat:3:cpu_stat3:intrblk    30
 cpu_stat:3:cpu_stat3:intrthread 59626
-.fi
-.in -2
-.sp
-
-.LP
-\fBExample 3 \fRUsing the \fBkstat\fR Command
-.sp
-.in +2
-.nf
+.Ed
+.
+.Ss Example 3: Using the kstat Command
+.Bd -literal -offset indent
 example$ \fBkstat -p :::state ':::avenrun*'\fR
 example$ \fBkstat -p :::state :::/^avenrun/\fR
-
+.sp
 cpu_info:0:cpu_info0:state      on-line
 cpu_info:1:cpu_info1:state      on-line
 cpu_info:2:cpu_info2:state      on-line
@@ -268,123 +228,58 @@
 unix:0:system_misc:avenrun_15min        4
 unix:0:system_misc:avenrun_1min 10
 unix:0:system_misc:avenrun_5min 3
-.fi
-.in -2
-.sp
-
-.LP
-\fBExample 4 \fRUsing the \fBkstat\fR Command
-.sp
-.in +2
-.nf
+.Ed
+.
+.Ss Example 4: Using the kstat Command
+.Bd -literal -offset indent
 example$ \fBkstat -p 'unix:0:system_misc:avenrun*' 1 3\fR
 unix:0:system_misc:avenrun_15min        15
 unix:0:system_misc:avenrun_1min 11
 unix:0:system_misc:avenrun_5min 21
-
+.sp
 unix:0:system_misc:avenrun_15min        15
 unix:0:system_misc:avenrun_1min 11
 unix:0:system_misc:avenrun_5min 21
-
+.sp
 unix:0:system_misc:avenrun_15min        15
 unix:0:system_misc:avenrun_1min 11
 unix:0:system_misc:avenrun_5min 21
-.fi
-.in -2
-.sp
-
-.LP
-\fBExample 5 \fRUsing the \fBkstat\fR Command
-.sp
-.in +2
-.nf
+.Ed
+.
+.Ss Example 5: Using the kstat Command
+.Bd -literal -offset indent
 example$ \fBkstat -p -T d 'unix:0:system_misc:avenrun*' 5 2\fR
 Thu Jul 22 19:39:50 1999
 unix:0:system_misc:avenrun_15min        12
 unix:0:system_misc:avenrun_1min 0
 unix:0:system_misc:avenrun_5min 11
-
+.sp
 Thu Jul 22 19:39:55 1999
 unix:0:system_misc:avenrun_15min        12
 unix:0:system_misc:avenrun_1min 0
 unix:0:system_misc:avenrun_5min 11
-.fi
-.in -2
-.sp
-
-.LP
-\fBExample 6 \fRUsing the \fBkstat\fR Command
-.sp
-.in +2
-.nf
+.Ed
+.
+.Ss Example 6: Using the kstat Command
+.Bd -literal -offset indent
 example$ \fBkstat -p -T u 'unix:0:system_misc:avenrun*'\fR
 932668656
 unix:0:system_misc:avenrun_15min        14
 unix:0:system_misc:avenrun_1min 5
 unix:0:system_misc:avenrun_5min 18
-.fi
-.in -2
-.sp
-
-.SH EXIT STATUS
-.sp
-.LP
-The following exit values are returned:
-.sp
-.ne 2
-.na
-\fB\fB0\fR\fR
-.ad
-.RS 5n
-One or more statistics were matched.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB1\fR\fR
-.ad
-.RS 5n
-No statistics were matched.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB2\fR\fR
-.ad
-.RS 5n
-Invalid command line options were specified.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB3\fR\fR
-.ad
-.RS 5n
-A fatal error occurred.
-.RE
-
-.SH FILES
-.sp
-.ne 2
-.na
-\fB\fB/dev/kstat\fR\fR
-.ad
-.RS 14n
-kernel statistics driver
-.RE
-
-.SH SEE ALSO
-.sp
-.LP
-\fBdate\fR(1), \fBsh\fR(1), \fBtime\fR(2), \fBgmatch\fR(3GEN),
-\fBkstat\fR(3KSTAT), \fBattributes\fR(5), \fBregex\fR(5), \fBkstat\fR(7D),
-\fBsd\fR(7D), \fBkstat\fR(9S)
-.SH NOTES
-.sp
-.LP
+.Ed
+.Sh SEE ALSO
+.Xr date 1 ,
+.Xr sh 1 ,
+.Xr time 2 ,
+.Xr clock_gettime 3C ,
+.Xr gmatch 3GEN ,
+.Xr kstat 3KSTAT ,
+.Xr regex 5 ,
+.Xr kstat 7D ,
+.Xr sd 7D ,
+.Xr kstat 9S
+.Sh NOTES
 If the pattern argument contains glob or RE metacharacters which are also
 shell metacharacters, it will be necessary to enclose the pattern with
 appropriate shell quotes.
--- old/usr/src/man/man9f/kstat_named_init.9f	Thu Jan 28 18:01:11 2016
+++ new/usr/src/man/man9f/kstat_named_init.9f	Thu Jan 28 18:01:11 2016
@@ -1,146 +1,116 @@
-'\" te
+.\" Copyright 2016 Garrett D'Amore
 .\" Copyright (c) 2006, Sun Microsystems, Inc., All Rights Reserved
 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH KSTAT_NAMED_INIT 9F "Feb 29, 2008"
-.SH NAME
-kstat_named_init, kstat_named_setstr \- initialize a named kstat
-.SH SYNOPSIS
-.LP
-.nf
-#include <sys/types.h>
-#include <sys/kstat.h>
-
-
-
-\fBvoid\fR \fBkstat_named_init\fR(\fBkstat_named_t *\fR\fIknp\fR, \fBconst char *\fR\fIname\fR,
-     \fBuchar_t\fR \fIdata_type\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBkstat_named_setstr\fR(\fBkstat_named_t *\fR\fIknp\fR, \fBconst char *\fR\fIstr\fR);
-.fi
-
-.SH INTERFACE LEVEL
-.LP
+.Dd Jan 27, 2016
+.Dt KSTAT_NAMED_INIT 9F
+.Os
+.Sh NAME
+.Nm kstat_named_init
+.Nm kstat_named_setstr
+.Nd initialize a named kstat
+.Sh SYNOPSIS
+.Hf <sys/types.h>
+.br
+.Hf <sys/kstat.h>
+.Lp
+.Ft void
+.Fo kstat_named_init
+.Fa "kstat_named_t *knp"
+.Fa "const char *name"
+.Fa "uchar_t data_type"
+.Fc
+.Lp
+.Ft void
+.Fo kstat_named_setstr
+.Fa "kstat_named_t *knp"
+.Fa "const char *str"
+.Fc
+.Sh INTERFACE LEVEL
 Solaris DDI specific (Solaris DDI)
-.SH PARAMETERS
-.ne 2
-.na
-\fB\fIknp\fR\fR
-.ad
-.RS 13n
-Pointer to a \fBkstat_named\fR(9S) structure.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIname\fR\fR
-.ad
-.RS 13n
+.Sh PARAMETERS
+.Bl -tag -width Ds
+.It Fa knp
+Pointer to a
+.Xr kstat_named 9S
+structure.
+.It Fa name
 The name of the statistic.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIdata_type\fR\fR
-.ad
-.RS 13n
-The type of value. This indicates which field of the \fBkstat_named\fR(9S)
+.It Fa data_type
+The type of value. This indicates which field of the
+.Xr kstat_named 9S
 structure should be used. Valid values are:
-.sp
-.ne 2
-.na
-\fB\fBKSTAT_DATA_CHAR\fR\fR
-.ad
-.RS 24n
-The "\fBchar\fR" field.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBKSTAT_DATA_LONG\fR\fR
-.ad
-.RS 24n
-The "\fBlong\fR" field.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBKSTAT_DATA_ULONG\fR\fR
-.ad
-.RS 24n
-The "\fBunsigned long\fR" field.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBKSTAT_DATA_LONGLONG\fR\fR
-.ad
-.RS 24n
-Obsolete. Use \fBKSTAT_DATA_INT64\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBKSTAT_DATA_ULONGLONG\fR\fR
-.ad
-.RS 24n
-Obsolete. Use \fBKSTAT_DATA_UINT64\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBKSTAT_DATA_STRING\fR\fR
-.ad
-.RS 24n
-Arbitrary length "\fBlong string\fR" field.
-.RE
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIstr\fR\fR
-.ad
-.RS 13n
-Pointer to a \fBNULL\fR-terminated string.
-.RE
-
-.SH DESCRIPTION
-.LP
-\fBkstat_named_init()\fR associates a name and a type with a
-\fBkstat_named\fR(9S) structure.
-.sp
-.LP
-\fBkstat_named_setstr()\fR associates \fIstr\fR with the named kstat \fBknp\fR.
-It is an error for \fBknp\fR to be of type other than \fBKSTAT_DATA_STRING\fR.
+.Bl -tag -width Ds
+.It Sy KSTAT_DATA_CHAR
+The "char" field.
+.
+.It Sy KSTAT_DATA_LONG
+The "long" field.
+.
+.It Sy KSTAT_DATA_ULONG
+The "unsigned long" field.
+.
+.It Sy KSTAT_DATA_LONGLONG
+Obsolete. Use
+.Sy KSTAT_DATA_INT64 .
+.
+.It Sy KSTAT_DATA_ULONGLONG
+Obsolete. Use
+.Sy KSTAT_DATA_UINT64 .
+.
+.It Sy KSTAT_DATA_STRING
+Arbitrary length "long string" field.
+.
+.It Sy KSTAT_DATA_TIME
+The high resolution time stamp field.  Note that this should only be used
+for absolute time stamps, such as returned by
+.Xr gethrtime 9F ,
+and not for relative durations.  For relative durations,
+.Sy KSTAT_DATA_UINT64
+is preferred.
+.El
+.It Fa str
+Pointer to a
+.Sy NULL- Ns No terminated
+string.
+.El
+.Sh DESCRIPTION
+.Fn kstat_named_init
+associates a name and a type with a
+.Xr kstat_named 9S
+structure.
+.Lp
+.Fn kstat_named_setstr
+associates
+.Fa str
+with the named kstat
+.Fa knp .
+It is an error for
+.Fa knp
+to be of type other than
+.Sy KSTAT_DATA_STRING .
 The string argument must remain valid even after the function that is calling
-\fBkstat_named_setstr()\fR is returned. If \fBKSTAT_DATA_STRING\fR is used in a
+.Fn kstat_named_setstr
+is returned. If
+.Sy KSTAT_DATA_STRING
+is used in a
 persistent kstat the string argument must remain valid even after the module
-that created the kstat is unloaded. This is the only supported method of changing
-the value of long strings.
-.SH RETURN VALUES
-.LP
+that created the kstat is unloaded.
+This is the only supported method of changing the value of long strings.
+.Sh CONTEXT
+.Fn kstat_named_init
+and
+.Fn kstat_named_setstr
+can be called from user or kernel context.
+.Sh RETURN VALUES
 None.
-.SH CONTEXT
-.LP
-\fBkstat_named_init()\fR and \fBkstat_named_setstr()\fR can be called from user
-or kernel context.
-.SH SEE ALSO
-.LP
-\fBkstat_create\fR(9F), \fBkstat_install\fR(9F), \fBkstat\fR(9S),
-\fBkstat_named\fR(9S)
-.sp
-.LP
-\fIWriting Device Drivers\fR
+.Sh SEE ALSO
+.Xr gethrtime 9F ,
+.Xr kstat_create 9F ,
+.Xr kstat_install 9F ,
+.Xr kstat 9S ,
+.Xr kstat_named 9S
+.Rs
+.%B Writing Device Drivers
+.Re
--- old/usr/src/uts/common/sys/kstat.h	Thu Jan 28 18:01:12 2016
+++ new/usr/src/uts/common/sys/kstat.h	Thu Jan 28 18:01:12 2016
@@ -23,6 +23,7 @@
  * Use is subject to license terms.
  *
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2016 Garrett D'Amore
  */
 
 #ifndef	_SYS_KSTAT_H
@@ -482,6 +483,8 @@
 		long		l;
 		ulong_t		ul;
 
+		hrtime_t	t;
+
 		/* These structure members are obsolete */
 
 		longlong_t	ll;
@@ -528,6 +531,11 @@
  */
 #define	KSTAT_DATA_STRING	9
 
+/*
+ * Value is an hrtime_t, in seconds since system boot.
+ */
+#define	KSTAT_DATA_TIME		10
+
 /* These types are obsolete */
 
 #define	KSTAT_DATA_LONGLONG	KSTAT_DATA_INT64
