diff options
author | cth <none@none> | 2006-10-12 10:18:45 -0700 |
---|---|---|
committer | cth <none@none> | 2006-10-12 10:18:45 -0700 |
commit | 37fbbce5257519d600faa3d23d464b42b71c1605 (patch) | |
tree | c0f2a50b50b97964740ab5a7586f74bd87560678 /usr/src/cmd/stat/common/acquire.c | |
parent | 2bc4236aac4fe3a3ba80139bc39ee9f1e356ab55 (diff) | |
download | illumos-gate-37fbbce5257519d600faa3d23d464b42b71c1605.tar.gz |
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
Diffstat (limited to 'usr/src/cmd/stat/common/acquire.c')
-rw-r--r-- | usr/src/cmd/stat/common/acquire.c | 68 |
1 files changed, 63 insertions, 5 deletions
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 <unistd.h> #include <strings.h> #include <errno.h> +#include <limits.h> #include <poll.h> #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); + } + } +} |