From 37fbbce5257519d600faa3d23d464b42b71c1605 Mon Sep 17 00:00:00 2001 From: cth Date: Thu, 12 Oct 2006 10:18:45 -0700 Subject: PSARC 2005/574 MPxIO iostat improvements 4261677 iostat -x shows extra output 6316660 device name gets truncated after 9 chars with iostat -xX option. 6318308 extend support in mpxio and iostat to show I/T/L based path stats --- usr/src/cmd/stat/common/acquire.c | 68 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 5 deletions(-) (limited to 'usr/src/cmd/stat/common/acquire.c') diff --git a/usr/src/cmd/stat/common/acquire.c b/usr/src/cmd/stat/common/acquire.c index e3c911283c..cf17de7c3f 100644 --- a/usr/src/cmd/stat/common/acquire.c +++ b/usr/src/cmd/stat/common/acquire.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * 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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -34,6 +33,7 @@ #include #include #include +#include #include #define ARRAY_SIZE(a) (sizeof (a) / sizeof (*a)) @@ -345,7 +345,8 @@ retry: if (!err && (types & SNAP_PSETS)) err = acquire_psets(ss); - if (!err && (types & (SNAP_IODEVS | SNAP_CONTROLLERS | SNAP_IOPATHS))) + if (!err && (types & (SNAP_IODEVS | SNAP_CONTROLLERS | + SNAP_IOPATHS_LI | SNAP_IOPATHS_LTI))) err = acquire_iodevs(ss, kc, iodev_filter); if (!err && (types & SNAP_SYSTEM)) @@ -538,3 +539,60 @@ nr_active_cpus(struct snapshot *ss) return (count); } + +/* + * Return the number of ticks delta between two hrtime_t + * values. Attempt to cater for various kinds of overflow + * in hrtime_t - no matter how improbable. + */ +uint64_t +hrtime_delta(hrtime_t old, hrtime_t new) +{ + uint64_t del; + + if ((new >= old) && (old >= 0L)) + return (new - old); + else { + /* + * We've overflowed the positive portion of an + * hrtime_t. + */ + if (new < 0L) { + /* + * The new value is negative. Handle the + * case where the old value is positive or + * negative. + */ + uint64_t n1; + uint64_t o1; + + n1 = -new; + if (old > 0L) + return (n1 - old); + else { + o1 = -old; + del = n1 - o1; + return (del); + } + } else { + /* + * Either we've just gone from being negative + * to positive *or* the last entry was positive + * and the new entry is also positive but *less* + * than the old entry. This implies we waited + * quite a few days on a very fast system between + * iostat displays. + */ + if (old < 0L) { + uint64_t o2; + + o2 = -old; + del = UINT64_MAX - o2; + } else { + del = UINT64_MAX - old; + } + del += new; + return (del); + } + } +} -- cgit v1.2.3