17836SJohn.Forte@Sun.COM /*
27836SJohn.Forte@Sun.COM * CDDL HEADER START
37836SJohn.Forte@Sun.COM *
47836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the
57836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License").
67836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License.
77836SJohn.Forte@Sun.COM *
87836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing.
107836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions
117836SJohn.Forte@Sun.COM * and limitations under the License.
127836SJohn.Forte@Sun.COM *
137836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each
147836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the
167836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying
177836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner]
187836SJohn.Forte@Sun.COM *
197836SJohn.Forte@Sun.COM * CDDL HEADER END
207836SJohn.Forte@Sun.COM */
217836SJohn.Forte@Sun.COM /*
22*11576SSurya.Prakki@Sun.COM * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
237836SJohn.Forte@Sun.COM * Use is subject to license terms.
247836SJohn.Forte@Sun.COM */
257836SJohn.Forte@Sun.COM
267836SJohn.Forte@Sun.COM #include <stdio.h>
277836SJohn.Forte@Sun.COM #include <string.h>
287836SJohn.Forte@Sun.COM
297836SJohn.Forte@Sun.COM #include <kstat.h>
307836SJohn.Forte@Sun.COM #include <sys/inttypes.h>
317836SJohn.Forte@Sun.COM
327836SJohn.Forte@Sun.COM #include <nsctl.h>
337836SJohn.Forte@Sun.COM
347836SJohn.Forte@Sun.COM #include "dsstat.h"
357836SJohn.Forte@Sun.COM #include "common.h"
367836SJohn.Forte@Sun.COM
377836SJohn.Forte@Sun.COM #include "sdbc_stats.h"
387836SJohn.Forte@Sun.COM #include "report.h"
397836SJohn.Forte@Sun.COM
407836SJohn.Forte@Sun.COM extern short dflags;
417836SJohn.Forte@Sun.COM
427836SJohn.Forte@Sun.COM /*
437836SJohn.Forte@Sun.COM * Return the number of ticks delta between two hrtime_t
447836SJohn.Forte@Sun.COM * values. Attempt to cater for various kinds of overflow
457836SJohn.Forte@Sun.COM * in hrtime_t - no matter how improbable.
467836SJohn.Forte@Sun.COM */
477836SJohn.Forte@Sun.COM uint64_t
hrtime_delta(hrtime_t old,hrtime_t new)487836SJohn.Forte@Sun.COM hrtime_delta(hrtime_t old, hrtime_t new)
497836SJohn.Forte@Sun.COM {
507836SJohn.Forte@Sun.COM
517836SJohn.Forte@Sun.COM uint64_t del;
527836SJohn.Forte@Sun.COM
537836SJohn.Forte@Sun.COM if ((new >= old) && (old >= 0L)) {
547836SJohn.Forte@Sun.COM return (new - old);
557836SJohn.Forte@Sun.COM } else {
567836SJohn.Forte@Sun.COM /*
577836SJohn.Forte@Sun.COM * We've overflowed the positive portion of an
587836SJohn.Forte@Sun.COM * hrtime_t.
597836SJohn.Forte@Sun.COM */
607836SJohn.Forte@Sun.COM if (new < 0L) {
617836SJohn.Forte@Sun.COM /*
627836SJohn.Forte@Sun.COM * The new value is negative. Handle the
637836SJohn.Forte@Sun.COM * case where the old value is positive or
647836SJohn.Forte@Sun.COM * negative.
657836SJohn.Forte@Sun.COM */
667836SJohn.Forte@Sun.COM uint64_t n1;
677836SJohn.Forte@Sun.COM uint64_t o1;
687836SJohn.Forte@Sun.COM
697836SJohn.Forte@Sun.COM n1 = -new;
707836SJohn.Forte@Sun.COM
717836SJohn.Forte@Sun.COM if (old > 0L) {
727836SJohn.Forte@Sun.COM return (n1 - old);
737836SJohn.Forte@Sun.COM } else {
747836SJohn.Forte@Sun.COM o1 = -old;
757836SJohn.Forte@Sun.COM del = n1 - o1;
767836SJohn.Forte@Sun.COM return (del);
777836SJohn.Forte@Sun.COM }
787836SJohn.Forte@Sun.COM } else {
797836SJohn.Forte@Sun.COM /*
807836SJohn.Forte@Sun.COM * Either we've just gone from being negative
817836SJohn.Forte@Sun.COM * to positive *or* the last entry was positive
827836SJohn.Forte@Sun.COM * and the new entry is also positive but *less*
837836SJohn.Forte@Sun.COM * than the old entry. This implies we waited
847836SJohn.Forte@Sun.COM * quite a few days on a very fast system between
857836SJohn.Forte@Sun.COM * iostat displays.
867836SJohn.Forte@Sun.COM */
877836SJohn.Forte@Sun.COM if (old < 0L) {
887836SJohn.Forte@Sun.COM uint64_t o2;
897836SJohn.Forte@Sun.COM
907836SJohn.Forte@Sun.COM o2 = -old;
917836SJohn.Forte@Sun.COM del = UINT64_MAX - o2;
927836SJohn.Forte@Sun.COM } else {
937836SJohn.Forte@Sun.COM del = UINT64_MAX - old;
947836SJohn.Forte@Sun.COM }
957836SJohn.Forte@Sun.COM
967836SJohn.Forte@Sun.COM del += new;
977836SJohn.Forte@Sun.COM
987836SJohn.Forte@Sun.COM return (del);
997836SJohn.Forte@Sun.COM }
1007836SJohn.Forte@Sun.COM }
1017836SJohn.Forte@Sun.COM }
1027836SJohn.Forte@Sun.COM
1037836SJohn.Forte@Sun.COM /*
1047836SJohn.Forte@Sun.COM * Take the difference of an unsigned 32
1057836SJohn.Forte@Sun.COM * bit int attempting to cater for
1067836SJohn.Forte@Sun.COM * overflow.
1077836SJohn.Forte@Sun.COM */
1087836SJohn.Forte@Sun.COM uint32_t
u32_delta(uint32_t old,uint32_t new)1097836SJohn.Forte@Sun.COM u32_delta(uint32_t old, uint32_t new)
1107836SJohn.Forte@Sun.COM {
1117836SJohn.Forte@Sun.COM
1127836SJohn.Forte@Sun.COM if (new >= old)
1137836SJohn.Forte@Sun.COM return (new - old);
1147836SJohn.Forte@Sun.COM else
1157836SJohn.Forte@Sun.COM return ((UINT32_MAX - old) + new + 1);
1167836SJohn.Forte@Sun.COM }
1177836SJohn.Forte@Sun.COM
1187836SJohn.Forte@Sun.COM /*
1197836SJohn.Forte@Sun.COM * Take the difference of an unsigned 64
1207836SJohn.Forte@Sun.COM * bit int attempting to cater for
1217836SJohn.Forte@Sun.COM * overflow.
1227836SJohn.Forte@Sun.COM */
1237836SJohn.Forte@Sun.COM uint64_t
u64_delta(uint64_t old,uint64_t new)1247836SJohn.Forte@Sun.COM u64_delta(uint64_t old, uint64_t new)
1257836SJohn.Forte@Sun.COM {
1267836SJohn.Forte@Sun.COM
1277836SJohn.Forte@Sun.COM if (new >= old)
1287836SJohn.Forte@Sun.COM return (new - old);
1297836SJohn.Forte@Sun.COM else
1307836SJohn.Forte@Sun.COM return ((UINT64_MAX - old) + new + 1);
1317836SJohn.Forte@Sun.COM }
1327836SJohn.Forte@Sun.COM
1337836SJohn.Forte@Sun.COM /*
1347836SJohn.Forte@Sun.COM * io_report() - diffs and reports data contained in
1357836SJohn.Forte@Sun.COM * kstat_io_t structures.
1367836SJohn.Forte@Sun.COM *
1377836SJohn.Forte@Sun.COM * parameters
1387836SJohn.Forte@Sun.COM * kstat_io_t *cur - pointer to current data
1397836SJohn.Forte@Sun.COM *
1407836SJohn.Forte@Sun.COM * kstat_io_t *pre - pointer to data as it was
1417836SJohn.Forte@Sun.COM * at the beginning of an interval.
1427836SJohn.Forte@Sun.COM */
1437836SJohn.Forte@Sun.COM void
io_report(kstat_t * cur_kstat,kstat_t * pre_kstat,sdbcstat_t * sdbcstat)14410714SThomas.Atkins@Sun.COM io_report(kstat_t *cur_kstat, kstat_t *pre_kstat, sdbcstat_t *sdbcstat)
1457836SJohn.Forte@Sun.COM {
1467836SJohn.Forte@Sun.COM sdbcvals_t vals;
1477836SJohn.Forte@Sun.COM
1487836SJohn.Forte@Sun.COM double rd_cnt, wr_cnt;
1497836SJohn.Forte@Sun.COM double rd_kb, wr_kb, hr_etime;
1507836SJohn.Forte@Sun.COM
1517836SJohn.Forte@Sun.COM double rtm, tps, avs, etime;
1527836SJohn.Forte@Sun.COM
15310714SThomas.Atkins@Sun.COM kstat_io_t *cur = cur_kstat->ks_data;
15410714SThomas.Atkins@Sun.COM kstat_io_t *pre = pre_kstat->ks_data;
15510714SThomas.Atkins@Sun.COM
1567836SJohn.Forte@Sun.COM if (sdbcstat &&
1577836SJohn.Forte@Sun.COM sdbc_getvalues(sdbcstat, &vals, (SDBC_KBYTES | SDBC_INTAVG)))
1587836SJohn.Forte@Sun.COM return;
1597836SJohn.Forte@Sun.COM
1607836SJohn.Forte@Sun.COM /* Time */
16110714SThomas.Atkins@Sun.COM hr_etime = hrtime_delta(pre_kstat->ks_snaptime, cur_kstat->ks_snaptime);
1627836SJohn.Forte@Sun.COM etime = hr_etime / (double)NANOSEC;
1637836SJohn.Forte@Sun.COM
1647836SJohn.Forte@Sun.COM /* Read count */
1657836SJohn.Forte@Sun.COM rd_cnt = (double)u32_delta(pre->reads, cur->reads);
1667836SJohn.Forte@Sun.COM if (rd_cnt) rd_cnt /= etime;
1677836SJohn.Forte@Sun.COM
1687836SJohn.Forte@Sun.COM /* Bytes read */
1697836SJohn.Forte@Sun.COM rd_kb = (double)u64_delta(pre->nread, cur->nread) / KILOBYTE;
1707836SJohn.Forte@Sun.COM if (rd_kb) rd_kb /= etime;
1717836SJohn.Forte@Sun.COM
1727836SJohn.Forte@Sun.COM /* Write count */
1737836SJohn.Forte@Sun.COM wr_cnt = (double)u32_delta(pre->writes, cur->writes);
1747836SJohn.Forte@Sun.COM if (wr_cnt) wr_cnt /= etime;
1757836SJohn.Forte@Sun.COM
1767836SJohn.Forte@Sun.COM /* Bytes written */
1777836SJohn.Forte@Sun.COM wr_kb = (double)u64_delta(pre->nwritten, cur->nwritten) / KILOBYTE;
1787836SJohn.Forte@Sun.COM if (wr_kb) wr_kb /= etime;
1797836SJohn.Forte@Sun.COM
1807836SJohn.Forte@Sun.COM /* Calculate service times */
1817836SJohn.Forte@Sun.COM avs = (double)hrtime_delta(pre->rlentime, cur->rlentime) / hr_etime;
1827836SJohn.Forte@Sun.COM tps = (double)rd_cnt + wr_cnt;
1837836SJohn.Forte@Sun.COM
1847836SJohn.Forte@Sun.COM if (tps > 0)
1857836SJohn.Forte@Sun.COM rtm = (1000 / tps) * avs;
1867836SJohn.Forte@Sun.COM else
1877836SJohn.Forte@Sun.COM rtm = 0.0;
1887836SJohn.Forte@Sun.COM
1897836SJohn.Forte@Sun.COM /* Output */
1907836SJohn.Forte@Sun.COM if (dflags & SUMMARY) {
1917836SJohn.Forte@Sun.COM if ((mode & MULTI) && (mode & SDBC)) {
1927836SJohn.Forte@Sun.COM if (sdbcstat) {
193*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT,
194*11576SSurya.Prakki@Sun.COM (float)vals.total_cache);
195*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT,
196*11576SSurya.Prakki@Sun.COM (float)vals.total_disk);
1977836SJohn.Forte@Sun.COM } else {
198*11576SSurya.Prakki@Sun.COM (void) printf(DATA_C6, NO_INFO);
199*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT, rd_kb + wr_kb);
2007836SJohn.Forte@Sun.COM }
2017836SJohn.Forte@Sun.COM } else
202*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT, rd_kb + wr_kb);
2037836SJohn.Forte@Sun.COM
204*11576SSurya.Prakki@Sun.COM (void) printf(TPS_INF_FMT, (uint32_t)(rd_cnt + wr_cnt));
205*11576SSurya.Prakki@Sun.COM (void) printf(SVT_INF_FMT, rtm);
2067836SJohn.Forte@Sun.COM
2077836SJohn.Forte@Sun.COM goto done;
2087836SJohn.Forte@Sun.COM }
2097836SJohn.Forte@Sun.COM
2107836SJohn.Forte@Sun.COM if (dflags & READ) {
2117836SJohn.Forte@Sun.COM if ((mode & MULTI) && (mode & SDBC)) {
2127836SJohn.Forte@Sun.COM if (sdbcstat) {
213*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT,
214*11576SSurya.Prakki@Sun.COM (float)vals.cache_read);
215*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT,
216*11576SSurya.Prakki@Sun.COM (float)vals.disk_read);
2177836SJohn.Forte@Sun.COM } else {
218*11576SSurya.Prakki@Sun.COM (void) printf(DATA_C6, NO_INFO);
219*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT, rd_kb);
2207836SJohn.Forte@Sun.COM }
2217836SJohn.Forte@Sun.COM
2227836SJohn.Forte@Sun.COM } else
223*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT, rd_kb);
2247836SJohn.Forte@Sun.COM
225*11576SSurya.Prakki@Sun.COM (void) printf(TPS_INF_FMT, (uint32_t)rd_cnt);
2267836SJohn.Forte@Sun.COM }
2277836SJohn.Forte@Sun.COM
2287836SJohn.Forte@Sun.COM if (dflags & WRITE) {
2297836SJohn.Forte@Sun.COM if ((mode & MULTI) && (mode & SDBC)) {
2307836SJohn.Forte@Sun.COM if (sdbcstat) {
231*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT,
232*11576SSurya.Prakki@Sun.COM (float)vals.cache_write);
233*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT,
234*11576SSurya.Prakki@Sun.COM (float)vals.disk_write);
2357836SJohn.Forte@Sun.COM } else {
236*11576SSurya.Prakki@Sun.COM (void) printf(DATA_C6, NO_INFO);
237*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT, wr_kb);
2387836SJohn.Forte@Sun.COM }
2397836SJohn.Forte@Sun.COM
2407836SJohn.Forte@Sun.COM } else
241*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT, wr_kb);
2427836SJohn.Forte@Sun.COM
243*11576SSurya.Prakki@Sun.COM (void) printf(TPS_INF_FMT, (uint32_t)wr_cnt);
2447836SJohn.Forte@Sun.COM }
2457836SJohn.Forte@Sun.COM
2467836SJohn.Forte@Sun.COM if (dflags & TIMING) {
247*11576SSurya.Prakki@Sun.COM (void) printf(SVT_INF_FMT, rtm);
2487836SJohn.Forte@Sun.COM }
2497836SJohn.Forte@Sun.COM
2507836SJohn.Forte@Sun.COM done:
2517836SJohn.Forte@Sun.COM linesout++;
2527836SJohn.Forte@Sun.COM }
2537836SJohn.Forte@Sun.COM
2547836SJohn.Forte@Sun.COM int
io_value_check(kstat_io_t * pre,kstat_io_t * cur)2557836SJohn.Forte@Sun.COM io_value_check(kstat_io_t *pre, kstat_io_t *cur)
2567836SJohn.Forte@Sun.COM {
2577836SJohn.Forte@Sun.COM if (u32_delta(pre->reads, cur->reads))
2587836SJohn.Forte@Sun.COM return (1);
2597836SJohn.Forte@Sun.COM if (u32_delta(pre->writes, cur->writes))
2607836SJohn.Forte@Sun.COM return (1);
2617836SJohn.Forte@Sun.COM
2627836SJohn.Forte@Sun.COM return (0);
2637836SJohn.Forte@Sun.COM }
2647836SJohn.Forte@Sun.COM
2657836SJohn.Forte@Sun.COM /*
2667836SJohn.Forte@Sun.COM * cd_report() - reports cache desriptor related statistics
2677836SJohn.Forte@Sun.COM * based on the dflags global variable
2687836SJohn.Forte@Sun.COM *
2697836SJohn.Forte@Sun.COM * parameters
2707836SJohn.Forte@Sun.COM * sdbcstat_t *sdbcstat - pointer to the cache structure
2717836SJohn.Forte@Sun.COM * to be reported on.
2727836SJohn.Forte@Sun.COM */
2737836SJohn.Forte@Sun.COM void
cd_report(sdbcstat_t * sdbcstat)2747836SJohn.Forte@Sun.COM cd_report(sdbcstat_t *sdbcstat)
2757836SJohn.Forte@Sun.COM {
2767836SJohn.Forte@Sun.COM sdbcvals_t vals;
2777836SJohn.Forte@Sun.COM
2787836SJohn.Forte@Sun.COM /* Extract statistics, average for time */
2797836SJohn.Forte@Sun.COM if (sdbc_getvalues(sdbcstat, &vals, (SDBC_KBYTES | SDBC_INTAVG)))
2807836SJohn.Forte@Sun.COM return;
2817836SJohn.Forte@Sun.COM
2827836SJohn.Forte@Sun.COM /* Output */
2837836SJohn.Forte@Sun.COM if (rflags & MULTI) {
284*11576SSurya.Prakki@Sun.COM (void) printf(VOL_HDR_FMT, "");
2857836SJohn.Forte@Sun.COM
2867836SJohn.Forte@Sun.COM if (dflags & FLAGS) {
287*11576SSurya.Prakki@Sun.COM (void) printf(STAT_HDR_FMT, "");
288*11576SSurya.Prakki@Sun.COM (void) printf(STAT_HDR_FMT, "");
2897836SJohn.Forte@Sun.COM }
2907836SJohn.Forte@Sun.COM
2917836SJohn.Forte@Sun.COM if (dflags & PCTS)
292*11576SSurya.Prakki@Sun.COM (void) printf(PCT_HDR_FMT, "");
2937836SJohn.Forte@Sun.COM
2947836SJohn.Forte@Sun.COM if (dflags & SUMMARY) {
295*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT, (float)vals.total_cache);
296*11576SSurya.Prakki@Sun.COM (void) printf(DATA_C4, NO_INFO);
297*11576SSurya.Prakki@Sun.COM (void) printf(DATA_C4, NO_INFO);
298*11576SSurya.Prakki@Sun.COM (void) printf("\n");
2997836SJohn.Forte@Sun.COM linesout++;
3007836SJohn.Forte@Sun.COM return;
3017836SJohn.Forte@Sun.COM }
3027836SJohn.Forte@Sun.COM
3037836SJohn.Forte@Sun.COM if (dflags & READ) {
304*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT, (float)vals.cache_read);
305*11576SSurya.Prakki@Sun.COM (void) printf(DATA_C4, NO_INFO);
3067836SJohn.Forte@Sun.COM }
3077836SJohn.Forte@Sun.COM
3087836SJohn.Forte@Sun.COM if (dflags & WRITE) {
309*11576SSurya.Prakki@Sun.COM (void) printf(KPS_INF_FMT, (float)vals.cache_write);
310*11576SSurya.Prakki@Sun.COM (void) printf(DATA_C4, NO_INFO);
3117836SJohn.Forte@Sun.COM }
3127836SJohn.Forte@Sun.COM
3137836SJohn.Forte@Sun.COM if (dflags & TIMING) {
314*11576SSurya.Prakki@Sun.COM (void) printf(DATA_C4, NO_INFO);
3157836SJohn.Forte@Sun.COM }
3167836SJohn.Forte@Sun.COM
3177836SJohn.Forte@Sun.COM linesout++;
318*11576SSurya.Prakki@Sun.COM (void) printf("\n");
3197836SJohn.Forte@Sun.COM return;
3207836SJohn.Forte@Sun.COM }
3217836SJohn.Forte@Sun.COM
3227836SJohn.Forte@Sun.COM if (dflags & SUMMARY) {
3237836SJohn.Forte@Sun.COM (void) printf(DATA_I32, vals.total_cache);
3247836SJohn.Forte@Sun.COM (void) printf(DATA_I32, vals.total_disk);
3257836SJohn.Forte@Sun.COM (void) printf(HIT_INF_FMT, vals.cache_hit);
3267836SJohn.Forte@Sun.COM
3277836SJohn.Forte@Sun.COM linesout++;
328*11576SSurya.Prakki@Sun.COM (void) printf("\n");
3297836SJohn.Forte@Sun.COM return;
3307836SJohn.Forte@Sun.COM }
3317836SJohn.Forte@Sun.COM
3327836SJohn.Forte@Sun.COM if (dflags & READ) {
3337836SJohn.Forte@Sun.COM (void) printf(DATA_I32, vals.cache_read);
3347836SJohn.Forte@Sun.COM (void) printf(DATA_I32, vals.disk_read);
3357836SJohn.Forte@Sun.COM (void) printf(HIT_INF_FMT, vals.read_hit);
3367836SJohn.Forte@Sun.COM }
3377836SJohn.Forte@Sun.COM
3387836SJohn.Forte@Sun.COM if (dflags & WRITE) {
3397836SJohn.Forte@Sun.COM (void) printf(DATA_I32, vals.cache_write);
3407836SJohn.Forte@Sun.COM (void) printf(DATA_I32, vals.disk_write);
3417836SJohn.Forte@Sun.COM (void) printf(HIT_INF_FMT, vals.write_hit);
3427836SJohn.Forte@Sun.COM }
3437836SJohn.Forte@Sun.COM
3447836SJohn.Forte@Sun.COM if (dflags & DESTAGED)
3457836SJohn.Forte@Sun.COM (void) printf(DATA_I32, vals.destaged);
3467836SJohn.Forte@Sun.COM
3477836SJohn.Forte@Sun.COM if (dflags & WRCANCEL)
3487836SJohn.Forte@Sun.COM (void) printf(DATA_I32, vals.write_cancellations);
3497836SJohn.Forte@Sun.COM
3507836SJohn.Forte@Sun.COM linesout++;
351*11576SSurya.Prakki@Sun.COM (void) printf("\n");
3527836SJohn.Forte@Sun.COM }
3537836SJohn.Forte@Sun.COM
3547836SJohn.Forte@Sun.COM /*
3557836SJohn.Forte@Sun.COM * header() - outputs an appropriate header by referencing the
3567836SJohn.Forte@Sun.COM * global variables dflsgs and rflags
3577836SJohn.Forte@Sun.COM *
3587836SJohn.Forte@Sun.COM */
3597836SJohn.Forte@Sun.COM void
header()3607836SJohn.Forte@Sun.COM header()
3617836SJohn.Forte@Sun.COM {
3627836SJohn.Forte@Sun.COM if (hflags & HEADERS_EXL)
3637836SJohn.Forte@Sun.COM if ((linesout % DISPLAY_LINES) != 0)
3647836SJohn.Forte@Sun.COM return;
3657836SJohn.Forte@Sun.COM
3667836SJohn.Forte@Sun.COM if (hflags & HEADERS_BOR)
3677836SJohn.Forte@Sun.COM if (linesout != 0)
3687836SJohn.Forte@Sun.COM return;
3697836SJohn.Forte@Sun.COM
3707836SJohn.Forte@Sun.COM if (hflags & HEADERS_ATT)
3717836SJohn.Forte@Sun.COM if (hflags & HEADERS_OUT)
3727836SJohn.Forte@Sun.COM return;
3737836SJohn.Forte@Sun.COM else
3747836SJohn.Forte@Sun.COM hflags |= HEADERS_OUT;
3757836SJohn.Forte@Sun.COM
3767836SJohn.Forte@Sun.COM if (linesout)
3777836SJohn.Forte@Sun.COM (void) printf("\n");
3787836SJohn.Forte@Sun.COM
379*11576SSurya.Prakki@Sun.COM (void) printf(VOL_HDR_FMT, SET_HDR_TXT);
3807836SJohn.Forte@Sun.COM
3817836SJohn.Forte@Sun.COM if (dflags & FLAGS) {
382*11576SSurya.Prakki@Sun.COM (void) printf(STAT_HDR_FMT, TYPE_HDR_TXT);
383*11576SSurya.Prakki@Sun.COM (void) printf(STAT_HDR_FMT, STAT_HDR_TXT);
3847836SJohn.Forte@Sun.COM }
3857836SJohn.Forte@Sun.COM
3867836SJohn.Forte@Sun.COM if (dflags & ASYNC_QUEUE)
387*11576SSurya.Prakki@Sun.COM (void) printf(STAT_HDR_FMT, QUEUE_HDR_TXT);
3887836SJohn.Forte@Sun.COM
3897836SJohn.Forte@Sun.COM if (dflags & PCTS)
390*11576SSurya.Prakki@Sun.COM (void) printf(PCT_HDR_FMT, PCT_HDR_TXT);
3917836SJohn.Forte@Sun.COM
392*11576SSurya.Prakki@Sun.COM (void) printf(ROLE_HDR_FMT, ROLE_HDR_TXT);
3937836SJohn.Forte@Sun.COM
3947836SJohn.Forte@Sun.COM if (dflags & ASYNC_QUEUE) {
395*11576SSurya.Prakki@Sun.COM (void) printf(TPS_HDR_FMT, QUEUE_ITEMS_TXT);
396*11576SSurya.Prakki@Sun.COM (void) printf(KPS_HDR_FMT, QUEUE_KBYTES_TXT);
397*11576SSurya.Prakki@Sun.COM (void) printf(TPS_HDR_FMT, QUEUE_ITEMS_HW_TXT);
398*11576SSurya.Prakki@Sun.COM (void) printf(KPS_HDR_FMT, QUEUE_KBYTES_HW_TXT);
3997836SJohn.Forte@Sun.COM }
4007836SJohn.Forte@Sun.COM
4017836SJohn.Forte@Sun.COM if (dflags & SUMMARY) {
4027836SJohn.Forte@Sun.COM if ((mode & MULTI) && (mode & SDBC)) {
403*11576SSurya.Prakki@Sun.COM (void) printf(KPS_HDR_FMT, CKPS_HDR_TXT);
404*11576SSurya.Prakki@Sun.COM (void) printf(KPS_HDR_FMT, DKPS_HDR_TXT);
4057836SJohn.Forte@Sun.COM } else
406*11576SSurya.Prakki@Sun.COM (void) printf(KPS_HDR_FMT, KPS_HDR_TXT);
407*11576SSurya.Prakki@Sun.COM (void) printf(TPS_HDR_FMT, TPS_HDR_TXT);
408*11576SSurya.Prakki@Sun.COM (void) printf(SVT_HDR_FMT, SVT_HDR_TXT);
4097836SJohn.Forte@Sun.COM
410*11576SSurya.Prakki@Sun.COM (void) printf("\n");
4117836SJohn.Forte@Sun.COM
4127836SJohn.Forte@Sun.COM return;
4137836SJohn.Forte@Sun.COM }
4147836SJohn.Forte@Sun.COM
4157836SJohn.Forte@Sun.COM if (dflags & READ) {
4167836SJohn.Forte@Sun.COM if ((mode & MULTI) && (mode & SDBC)) {
417*11576SSurya.Prakki@Sun.COM (void) printf(KPS_HDR_FMT, CRKPS_HDR_TXT);
418*11576SSurya.Prakki@Sun.COM (void) printf(KPS_HDR_FMT, DRKPS_HDR_TXT);
4197836SJohn.Forte@Sun.COM } else
420*11576SSurya.Prakki@Sun.COM (void) printf(KPS_HDR_FMT, RKPS_HDR_TXT);
4217836SJohn.Forte@Sun.COM
422*11576SSurya.Prakki@Sun.COM (void) printf(TPS_HDR_FMT, RTPS_HDR_TXT);
4237836SJohn.Forte@Sun.COM }
4247836SJohn.Forte@Sun.COM
4257836SJohn.Forte@Sun.COM if (dflags & WRITE) {
4267836SJohn.Forte@Sun.COM if ((mode & MULTI) && (mode & SDBC)) {
427*11576SSurya.Prakki@Sun.COM (void) printf(KPS_HDR_FMT, CWKPS_HDR_TXT);
428*11576SSurya.Prakki@Sun.COM (void) printf(KPS_HDR_FMT, DWKPS_HDR_TXT);
4297836SJohn.Forte@Sun.COM } else
430*11576SSurya.Prakki@Sun.COM (void) printf(KPS_HDR_FMT, WKPS_HDR_TXT);
4317836SJohn.Forte@Sun.COM
432*11576SSurya.Prakki@Sun.COM (void) printf(TPS_HDR_FMT, WTPS_HDR_TXT);
4337836SJohn.Forte@Sun.COM }
4347836SJohn.Forte@Sun.COM
4357836SJohn.Forte@Sun.COM if (dflags & TIMING)
436*11576SSurya.Prakki@Sun.COM (void) printf(SVT_HDR_FMT, SVT_HDR_TXT);
4377836SJohn.Forte@Sun.COM
4387836SJohn.Forte@Sun.COM (void) printf("\n");
4397836SJohn.Forte@Sun.COM }
440