xref: /titanic_52/usr/src/cmd/avs/dsstat/report.c (revision 570de38f63910201fdd77246630b7aa8f9dc5661)
1fcf3ce44SJohn Forte /*
2fcf3ce44SJohn Forte  * CDDL HEADER START
3fcf3ce44SJohn Forte  *
4fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7fcf3ce44SJohn Forte  *
8fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11fcf3ce44SJohn Forte  * and limitations under the License.
12fcf3ce44SJohn Forte  *
13fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18fcf3ce44SJohn Forte  *
19fcf3ce44SJohn Forte  * CDDL HEADER END
20fcf3ce44SJohn Forte  */
21fcf3ce44SJohn Forte /*
22*570de38fSSurya Prakki  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23fcf3ce44SJohn Forte  * Use is subject to license terms.
24fcf3ce44SJohn Forte  */
25fcf3ce44SJohn Forte 
26fcf3ce44SJohn Forte #include <stdio.h>
27fcf3ce44SJohn Forte #include <string.h>
28fcf3ce44SJohn Forte 
29fcf3ce44SJohn Forte #include <kstat.h>
30fcf3ce44SJohn Forte #include <sys/inttypes.h>
31fcf3ce44SJohn Forte 
32fcf3ce44SJohn Forte #include <nsctl.h>
33fcf3ce44SJohn Forte 
34fcf3ce44SJohn Forte #include "dsstat.h"
35fcf3ce44SJohn Forte #include "common.h"
36fcf3ce44SJohn Forte 
37fcf3ce44SJohn Forte #include "sdbc_stats.h"
38fcf3ce44SJohn Forte #include "report.h"
39fcf3ce44SJohn Forte 
40fcf3ce44SJohn Forte extern short dflags;
41fcf3ce44SJohn Forte 
42fcf3ce44SJohn Forte /*
43fcf3ce44SJohn Forte  * Return the number of ticks delta between two hrtime_t
44fcf3ce44SJohn Forte  * values. Attempt to cater for various kinds of overflow
45fcf3ce44SJohn Forte  * in hrtime_t - no matter how improbable.
46fcf3ce44SJohn Forte  */
47fcf3ce44SJohn Forte uint64_t
48fcf3ce44SJohn Forte hrtime_delta(hrtime_t old, hrtime_t new)
49fcf3ce44SJohn Forte {
50fcf3ce44SJohn Forte 
51fcf3ce44SJohn Forte 	uint64_t del;
52fcf3ce44SJohn Forte 
53fcf3ce44SJohn Forte 	if ((new >= old) && (old >= 0L)) {
54fcf3ce44SJohn Forte 		return (new - old);
55fcf3ce44SJohn Forte 	} else {
56fcf3ce44SJohn Forte 		/*
57fcf3ce44SJohn Forte 		 * We've overflowed the positive portion of an
58fcf3ce44SJohn Forte 		 * hrtime_t.
59fcf3ce44SJohn Forte 		 */
60fcf3ce44SJohn Forte 		if (new < 0L) {
61fcf3ce44SJohn Forte 			/*
62fcf3ce44SJohn Forte 			 * The new value is negative. Handle the
63fcf3ce44SJohn Forte 			 * case where the old value is positive or
64fcf3ce44SJohn Forte 			 * negative.
65fcf3ce44SJohn Forte 			 */
66fcf3ce44SJohn Forte 			uint64_t n1;
67fcf3ce44SJohn Forte 			uint64_t o1;
68fcf3ce44SJohn Forte 
69fcf3ce44SJohn Forte 			n1 = -new;
70fcf3ce44SJohn Forte 
71fcf3ce44SJohn Forte 			if (old > 0L) {
72fcf3ce44SJohn Forte 				return (n1 - old);
73fcf3ce44SJohn Forte 			} else {
74fcf3ce44SJohn Forte 				o1 = -old;
75fcf3ce44SJohn Forte 				del = n1 - o1;
76fcf3ce44SJohn Forte 				return (del);
77fcf3ce44SJohn Forte 			}
78fcf3ce44SJohn Forte 		} else {
79fcf3ce44SJohn Forte 			/*
80fcf3ce44SJohn Forte 			 * Either we've just gone from being negative
81fcf3ce44SJohn Forte 			 * to positive *or* the last entry was positive
82fcf3ce44SJohn Forte 			 * and the new entry is also positive but *less*
83fcf3ce44SJohn Forte 			 * than the old entry. This implies we waited
84fcf3ce44SJohn Forte 			 * quite a few days on a very fast system between
85fcf3ce44SJohn Forte 			 * iostat displays.
86fcf3ce44SJohn Forte 			 */
87fcf3ce44SJohn Forte 			if (old < 0L) {
88fcf3ce44SJohn Forte 				uint64_t o2;
89fcf3ce44SJohn Forte 
90fcf3ce44SJohn Forte 				o2 = -old;
91fcf3ce44SJohn Forte 				del = UINT64_MAX - o2;
92fcf3ce44SJohn Forte 			} else {
93fcf3ce44SJohn Forte 				del = UINT64_MAX - old;
94fcf3ce44SJohn Forte 			}
95fcf3ce44SJohn Forte 
96fcf3ce44SJohn Forte 			del += new;
97fcf3ce44SJohn Forte 
98fcf3ce44SJohn Forte 			return (del);
99fcf3ce44SJohn Forte 		}
100fcf3ce44SJohn Forte 	}
101fcf3ce44SJohn Forte }
102fcf3ce44SJohn Forte 
103fcf3ce44SJohn Forte /*
104fcf3ce44SJohn Forte  * Take the difference of an unsigned 32
105fcf3ce44SJohn Forte  * bit int attempting to cater for
106fcf3ce44SJohn Forte  * overflow.
107fcf3ce44SJohn Forte  */
108fcf3ce44SJohn Forte uint32_t
109fcf3ce44SJohn Forte u32_delta(uint32_t old, uint32_t new)
110fcf3ce44SJohn Forte {
111fcf3ce44SJohn Forte 
112fcf3ce44SJohn Forte 	if (new >= old)
113fcf3ce44SJohn Forte 		return (new - old);
114fcf3ce44SJohn Forte 	else
115fcf3ce44SJohn Forte 		return ((UINT32_MAX - old) + new + 1);
116fcf3ce44SJohn Forte }
117fcf3ce44SJohn Forte 
118fcf3ce44SJohn Forte /*
119fcf3ce44SJohn Forte  * Take the difference of an unsigned 64
120fcf3ce44SJohn Forte  * bit int attempting to cater for
121fcf3ce44SJohn Forte  * overflow.
122fcf3ce44SJohn Forte  */
123fcf3ce44SJohn Forte uint64_t
124fcf3ce44SJohn Forte u64_delta(uint64_t old, uint64_t new)
125fcf3ce44SJohn Forte {
126fcf3ce44SJohn Forte 
127fcf3ce44SJohn Forte 	if (new >= old)
128fcf3ce44SJohn Forte 		return (new - old);
129fcf3ce44SJohn Forte 	else
130fcf3ce44SJohn Forte 		return ((UINT64_MAX - old) + new + 1);
131fcf3ce44SJohn Forte }
132fcf3ce44SJohn Forte 
133fcf3ce44SJohn Forte /*
134fcf3ce44SJohn Forte  * io_report() - diffs and reports data contained in
135fcf3ce44SJohn Forte  * kstat_io_t structures.
136fcf3ce44SJohn Forte  *
137fcf3ce44SJohn Forte  * parameters
138fcf3ce44SJohn Forte  * 	kstat_io_t *cur - pointer to current data
139fcf3ce44SJohn Forte  *
140fcf3ce44SJohn Forte  * 	kstat_io_t *pre - pointer to data as it was
141fcf3ce44SJohn Forte  * 	at the beginning of an interval.
142fcf3ce44SJohn Forte  */
143fcf3ce44SJohn Forte void
144e31df310SThomas Atkins io_report(kstat_t *cur_kstat, kstat_t *pre_kstat, sdbcstat_t *sdbcstat)
145fcf3ce44SJohn Forte {
146fcf3ce44SJohn Forte 	sdbcvals_t vals;
147fcf3ce44SJohn Forte 
148fcf3ce44SJohn Forte 	double rd_cnt, wr_cnt;
149fcf3ce44SJohn Forte 	double rd_kb, wr_kb, hr_etime;
150fcf3ce44SJohn Forte 
151fcf3ce44SJohn Forte 	double rtm, tps, avs, etime;
152fcf3ce44SJohn Forte 
153e31df310SThomas Atkins 	kstat_io_t *cur = cur_kstat->ks_data;
154e31df310SThomas Atkins 	kstat_io_t *pre = pre_kstat->ks_data;
155e31df310SThomas Atkins 
156fcf3ce44SJohn Forte 	if (sdbcstat &&
157fcf3ce44SJohn Forte 	    sdbc_getvalues(sdbcstat, &vals, (SDBC_KBYTES | SDBC_INTAVG)))
158fcf3ce44SJohn Forte 		return;
159fcf3ce44SJohn Forte 
160fcf3ce44SJohn Forte 	/* Time */
161e31df310SThomas Atkins 	hr_etime = hrtime_delta(pre_kstat->ks_snaptime, cur_kstat->ks_snaptime);
162fcf3ce44SJohn Forte 	etime = hr_etime / (double)NANOSEC;
163fcf3ce44SJohn Forte 
164fcf3ce44SJohn Forte 	/* Read count */
165fcf3ce44SJohn Forte 	rd_cnt = (double)u32_delta(pre->reads, cur->reads);
166fcf3ce44SJohn Forte 	if (rd_cnt) rd_cnt /= etime;
167fcf3ce44SJohn Forte 
168fcf3ce44SJohn Forte 	/* Bytes read */
169fcf3ce44SJohn Forte 	rd_kb = (double)u64_delta(pre->nread, cur->nread) / KILOBYTE;
170fcf3ce44SJohn Forte 	if (rd_kb) rd_kb /= etime;
171fcf3ce44SJohn Forte 
172fcf3ce44SJohn Forte 	/* Write count    */
173fcf3ce44SJohn Forte 	wr_cnt = (double)u32_delta(pre->writes, cur->writes);
174fcf3ce44SJohn Forte 	if (wr_cnt) wr_cnt /= etime;
175fcf3ce44SJohn Forte 
176fcf3ce44SJohn Forte 	/* Bytes written  */
177fcf3ce44SJohn Forte 	wr_kb = (double)u64_delta(pre->nwritten, cur->nwritten) / KILOBYTE;
178fcf3ce44SJohn Forte 	if (wr_kb) wr_kb /= etime;
179fcf3ce44SJohn Forte 
180fcf3ce44SJohn Forte 	/* Calculate service times */
181fcf3ce44SJohn Forte 	avs = (double)hrtime_delta(pre->rlentime, cur->rlentime) / hr_etime;
182fcf3ce44SJohn Forte 	tps = (double)rd_cnt + wr_cnt;
183fcf3ce44SJohn Forte 
184fcf3ce44SJohn Forte 	if (tps > 0)
185fcf3ce44SJohn Forte 		rtm = (1000 / tps) * avs;
186fcf3ce44SJohn Forte 	else
187fcf3ce44SJohn Forte 		rtm = 0.0;
188fcf3ce44SJohn Forte 
189fcf3ce44SJohn Forte 	/* Output */
190fcf3ce44SJohn Forte 	if (dflags & SUMMARY) {
191fcf3ce44SJohn Forte 		if ((mode & MULTI) && (mode & SDBC)) {
192fcf3ce44SJohn Forte 			if (sdbcstat) {
193*570de38fSSurya Prakki 				(void) printf(KPS_INF_FMT,
194*570de38fSSurya Prakki 				    (float)vals.total_cache);
195*570de38fSSurya Prakki 				(void) printf(KPS_INF_FMT,
196*570de38fSSurya Prakki 				    (float)vals.total_disk);
197fcf3ce44SJohn Forte 			} else {
198*570de38fSSurya Prakki 				(void) printf(DATA_C6, NO_INFO);
199*570de38fSSurya Prakki 				(void) printf(KPS_INF_FMT, rd_kb + wr_kb);
200fcf3ce44SJohn Forte 			}
201fcf3ce44SJohn Forte 		} else
202*570de38fSSurya Prakki 			(void) printf(KPS_INF_FMT, rd_kb + wr_kb);
203fcf3ce44SJohn Forte 
204*570de38fSSurya Prakki 		(void) printf(TPS_INF_FMT, (uint32_t)(rd_cnt + wr_cnt));
205*570de38fSSurya Prakki 		(void) printf(SVT_INF_FMT, rtm);
206fcf3ce44SJohn Forte 
207fcf3ce44SJohn Forte 		goto done;
208fcf3ce44SJohn Forte 	}
209fcf3ce44SJohn Forte 
210fcf3ce44SJohn Forte 	if (dflags & READ) {
211fcf3ce44SJohn Forte 		if ((mode & MULTI) && (mode & SDBC)) {
212fcf3ce44SJohn Forte 			if (sdbcstat) {
213*570de38fSSurya Prakki 				(void) printf(KPS_INF_FMT,
214*570de38fSSurya Prakki 				    (float)vals.cache_read);
215*570de38fSSurya Prakki 				(void) printf(KPS_INF_FMT,
216*570de38fSSurya Prakki 				    (float)vals.disk_read);
217fcf3ce44SJohn Forte 			} else {
218*570de38fSSurya Prakki 				(void) printf(DATA_C6, NO_INFO);
219*570de38fSSurya Prakki 				(void) printf(KPS_INF_FMT, rd_kb);
220fcf3ce44SJohn Forte 			}
221fcf3ce44SJohn Forte 
222fcf3ce44SJohn Forte 		} else
223*570de38fSSurya Prakki 			(void) printf(KPS_INF_FMT, rd_kb);
224fcf3ce44SJohn Forte 
225*570de38fSSurya Prakki 		(void) printf(TPS_INF_FMT, (uint32_t)rd_cnt);
226fcf3ce44SJohn Forte 	}
227fcf3ce44SJohn Forte 
228fcf3ce44SJohn Forte 	if (dflags & WRITE) {
229fcf3ce44SJohn Forte 		if ((mode & MULTI) && (mode & SDBC)) {
230fcf3ce44SJohn Forte 			if (sdbcstat) {
231*570de38fSSurya Prakki 				(void) printf(KPS_INF_FMT,
232*570de38fSSurya Prakki 				    (float)vals.cache_write);
233*570de38fSSurya Prakki 				(void) printf(KPS_INF_FMT,
234*570de38fSSurya Prakki 				    (float)vals.disk_write);
235fcf3ce44SJohn Forte 			} else {
236*570de38fSSurya Prakki 				(void) printf(DATA_C6, NO_INFO);
237*570de38fSSurya Prakki 				(void) printf(KPS_INF_FMT, wr_kb);
238fcf3ce44SJohn Forte 			}
239fcf3ce44SJohn Forte 
240fcf3ce44SJohn Forte 		} else
241*570de38fSSurya Prakki 			(void) printf(KPS_INF_FMT, wr_kb);
242fcf3ce44SJohn Forte 
243*570de38fSSurya Prakki 		(void) printf(TPS_INF_FMT, (uint32_t)wr_cnt);
244fcf3ce44SJohn Forte 	}
245fcf3ce44SJohn Forte 
246fcf3ce44SJohn Forte 	if (dflags & TIMING) {
247*570de38fSSurya Prakki 		(void) printf(SVT_INF_FMT, rtm);
248fcf3ce44SJohn Forte 	}
249fcf3ce44SJohn Forte 
250fcf3ce44SJohn Forte done:
251fcf3ce44SJohn Forte 	linesout++;
252fcf3ce44SJohn Forte }
253fcf3ce44SJohn Forte 
254fcf3ce44SJohn Forte int
255fcf3ce44SJohn Forte io_value_check(kstat_io_t *pre, kstat_io_t *cur)
256fcf3ce44SJohn Forte {
257fcf3ce44SJohn Forte 	if (u32_delta(pre->reads, cur->reads))
258fcf3ce44SJohn Forte 		return (1);
259fcf3ce44SJohn Forte 	if (u32_delta(pre->writes, cur->writes))
260fcf3ce44SJohn Forte 		return (1);
261fcf3ce44SJohn Forte 
262fcf3ce44SJohn Forte 	return (0);
263fcf3ce44SJohn Forte }
264fcf3ce44SJohn Forte 
265fcf3ce44SJohn Forte /*
266fcf3ce44SJohn Forte  * cd_report() - reports cache desriptor related statistics
267fcf3ce44SJohn Forte  * based on the dflags global variable
268fcf3ce44SJohn Forte  *
269fcf3ce44SJohn Forte  * parameters
270fcf3ce44SJohn Forte  * 	sdbcstat_t *sdbcstat - pointer to the cache structure
271fcf3ce44SJohn Forte  * 	to be reported on.
272fcf3ce44SJohn Forte  */
273fcf3ce44SJohn Forte void
274fcf3ce44SJohn Forte cd_report(sdbcstat_t *sdbcstat)
275fcf3ce44SJohn Forte {
276fcf3ce44SJohn Forte 	sdbcvals_t vals;
277fcf3ce44SJohn Forte 
278fcf3ce44SJohn Forte 	/* Extract statistics, average for time */
279fcf3ce44SJohn Forte 	if (sdbc_getvalues(sdbcstat, &vals, (SDBC_KBYTES | SDBC_INTAVG)))
280fcf3ce44SJohn Forte 		return;
281fcf3ce44SJohn Forte 
282fcf3ce44SJohn Forte 	/* Output */
283fcf3ce44SJohn Forte 	if (rflags & MULTI) {
284*570de38fSSurya Prakki 		(void) printf(VOL_HDR_FMT, "");
285fcf3ce44SJohn Forte 
286fcf3ce44SJohn Forte 		if (dflags & FLAGS) {
287*570de38fSSurya Prakki 			(void) printf(STAT_HDR_FMT, "");
288*570de38fSSurya Prakki 			(void) printf(STAT_HDR_FMT, "");
289fcf3ce44SJohn Forte 		}
290fcf3ce44SJohn Forte 
291fcf3ce44SJohn Forte 		if (dflags & PCTS)
292*570de38fSSurya Prakki 			(void) printf(PCT_HDR_FMT, "");
293fcf3ce44SJohn Forte 
294fcf3ce44SJohn Forte 		if (dflags & SUMMARY) {
295*570de38fSSurya Prakki 			(void) printf(KPS_INF_FMT, (float)vals.total_cache);
296*570de38fSSurya Prakki 			(void) printf(DATA_C4, NO_INFO);
297*570de38fSSurya Prakki 			(void) printf(DATA_C4, NO_INFO);
298*570de38fSSurya Prakki 			(void) printf("\n");
299fcf3ce44SJohn Forte 			linesout++;
300fcf3ce44SJohn Forte 			return;
301fcf3ce44SJohn Forte 		}
302fcf3ce44SJohn Forte 
303fcf3ce44SJohn Forte 		if (dflags & READ) {
304*570de38fSSurya Prakki 			(void) printf(KPS_INF_FMT, (float)vals.cache_read);
305*570de38fSSurya Prakki 			(void) printf(DATA_C4, NO_INFO);
306fcf3ce44SJohn Forte 		}
307fcf3ce44SJohn Forte 
308fcf3ce44SJohn Forte 		if (dflags & WRITE) {
309*570de38fSSurya Prakki 			(void) printf(KPS_INF_FMT, (float)vals.cache_write);
310*570de38fSSurya Prakki 			(void) printf(DATA_C4, NO_INFO);
311fcf3ce44SJohn Forte 		}
312fcf3ce44SJohn Forte 
313fcf3ce44SJohn Forte 		if (dflags & TIMING) {
314*570de38fSSurya Prakki 			(void) printf(DATA_C4, NO_INFO);
315fcf3ce44SJohn Forte 		}
316fcf3ce44SJohn Forte 
317fcf3ce44SJohn Forte 		linesout++;
318*570de38fSSurya Prakki 		(void) printf("\n");
319fcf3ce44SJohn Forte 		return;
320fcf3ce44SJohn Forte 	}
321fcf3ce44SJohn Forte 
322fcf3ce44SJohn Forte 	if (dflags & SUMMARY) {
323fcf3ce44SJohn Forte 		(void) printf(DATA_I32, vals.total_cache);
324fcf3ce44SJohn Forte 		(void) printf(DATA_I32, vals.total_disk);
325fcf3ce44SJohn Forte 		(void) printf(HIT_INF_FMT, vals.cache_hit);
326fcf3ce44SJohn Forte 
327fcf3ce44SJohn Forte 		linesout++;
328*570de38fSSurya Prakki 		(void) printf("\n");
329fcf3ce44SJohn Forte 		return;
330fcf3ce44SJohn Forte 	}
331fcf3ce44SJohn Forte 
332fcf3ce44SJohn Forte 	if (dflags & READ) {
333fcf3ce44SJohn Forte 		(void) printf(DATA_I32, vals.cache_read);
334fcf3ce44SJohn Forte 		(void) printf(DATA_I32, vals.disk_read);
335fcf3ce44SJohn Forte 		(void) printf(HIT_INF_FMT, vals.read_hit);
336fcf3ce44SJohn Forte 	}
337fcf3ce44SJohn Forte 
338fcf3ce44SJohn Forte 	if (dflags & WRITE) {
339fcf3ce44SJohn Forte 		(void) printf(DATA_I32, vals.cache_write);
340fcf3ce44SJohn Forte 		(void) printf(DATA_I32, vals.disk_write);
341fcf3ce44SJohn Forte 		(void) printf(HIT_INF_FMT, vals.write_hit);
342fcf3ce44SJohn Forte 	}
343fcf3ce44SJohn Forte 
344fcf3ce44SJohn Forte 	if (dflags & DESTAGED)
345fcf3ce44SJohn Forte 		(void) printf(DATA_I32, vals.destaged);
346fcf3ce44SJohn Forte 
347fcf3ce44SJohn Forte 	if (dflags & WRCANCEL)
348fcf3ce44SJohn Forte 		(void) printf(DATA_I32, vals.write_cancellations);
349fcf3ce44SJohn Forte 
350fcf3ce44SJohn Forte 	linesout++;
351*570de38fSSurya Prakki 	(void) printf("\n");
352fcf3ce44SJohn Forte }
353fcf3ce44SJohn Forte 
354fcf3ce44SJohn Forte /*
355fcf3ce44SJohn Forte  * header() - outputs an appropriate header by referencing the
356fcf3ce44SJohn Forte  * global variables dflsgs and rflags
357fcf3ce44SJohn Forte  *
358fcf3ce44SJohn Forte  */
359fcf3ce44SJohn Forte void
360fcf3ce44SJohn Forte header()
361fcf3ce44SJohn Forte {
362fcf3ce44SJohn Forte 	if (hflags & HEADERS_EXL)
363fcf3ce44SJohn Forte 		if ((linesout % DISPLAY_LINES) != 0)
364fcf3ce44SJohn Forte 			return;
365fcf3ce44SJohn Forte 
366fcf3ce44SJohn Forte 	if (hflags & HEADERS_BOR)
367fcf3ce44SJohn Forte 		if (linesout != 0)
368fcf3ce44SJohn Forte 			return;
369fcf3ce44SJohn Forte 
370fcf3ce44SJohn Forte 	if (hflags & HEADERS_ATT)
371fcf3ce44SJohn Forte 		if (hflags & HEADERS_OUT)
372fcf3ce44SJohn Forte 			return;
373fcf3ce44SJohn Forte 		else
374fcf3ce44SJohn Forte 			hflags |= HEADERS_OUT;
375fcf3ce44SJohn Forte 
376fcf3ce44SJohn Forte 	if (linesout)
377fcf3ce44SJohn Forte 		(void) printf("\n");
378fcf3ce44SJohn Forte 
379*570de38fSSurya Prakki 	(void) printf(VOL_HDR_FMT, SET_HDR_TXT);
380fcf3ce44SJohn Forte 
381fcf3ce44SJohn Forte 	if (dflags & FLAGS) {
382*570de38fSSurya Prakki 		(void) printf(STAT_HDR_FMT, TYPE_HDR_TXT);
383*570de38fSSurya Prakki 		(void) printf(STAT_HDR_FMT, STAT_HDR_TXT);
384fcf3ce44SJohn Forte 	}
385fcf3ce44SJohn Forte 
386fcf3ce44SJohn Forte 	if (dflags & ASYNC_QUEUE)
387*570de38fSSurya Prakki 		(void) printf(STAT_HDR_FMT, QUEUE_HDR_TXT);
388fcf3ce44SJohn Forte 
389fcf3ce44SJohn Forte 	if (dflags & PCTS)
390*570de38fSSurya Prakki 		(void) printf(PCT_HDR_FMT, PCT_HDR_TXT);
391fcf3ce44SJohn Forte 
392*570de38fSSurya Prakki 	(void) printf(ROLE_HDR_FMT, ROLE_HDR_TXT);
393fcf3ce44SJohn Forte 
394fcf3ce44SJohn Forte 	if (dflags & ASYNC_QUEUE) {
395*570de38fSSurya Prakki 		(void) printf(TPS_HDR_FMT, QUEUE_ITEMS_TXT);
396*570de38fSSurya Prakki 		(void) printf(KPS_HDR_FMT, QUEUE_KBYTES_TXT);
397*570de38fSSurya Prakki 		(void) printf(TPS_HDR_FMT, QUEUE_ITEMS_HW_TXT);
398*570de38fSSurya Prakki 		(void) printf(KPS_HDR_FMT, QUEUE_KBYTES_HW_TXT);
399fcf3ce44SJohn Forte 	}
400fcf3ce44SJohn Forte 
401fcf3ce44SJohn Forte 	if (dflags & SUMMARY) {
402fcf3ce44SJohn Forte 		if ((mode & MULTI) && (mode & SDBC)) {
403*570de38fSSurya Prakki 			(void) printf(KPS_HDR_FMT, CKPS_HDR_TXT);
404*570de38fSSurya Prakki 			(void) printf(KPS_HDR_FMT, DKPS_HDR_TXT);
405fcf3ce44SJohn Forte 		} else
406*570de38fSSurya Prakki 			(void) printf(KPS_HDR_FMT, KPS_HDR_TXT);
407*570de38fSSurya Prakki 		(void) printf(TPS_HDR_FMT, TPS_HDR_TXT);
408*570de38fSSurya Prakki 		(void) printf(SVT_HDR_FMT, SVT_HDR_TXT);
409fcf3ce44SJohn Forte 
410*570de38fSSurya Prakki 		(void) printf("\n");
411fcf3ce44SJohn Forte 
412fcf3ce44SJohn Forte 		return;
413fcf3ce44SJohn Forte 	}
414fcf3ce44SJohn Forte 
415fcf3ce44SJohn Forte 	if (dflags & READ) {
416fcf3ce44SJohn Forte 		if ((mode & MULTI) && (mode & SDBC)) {
417*570de38fSSurya Prakki 			(void) printf(KPS_HDR_FMT, CRKPS_HDR_TXT);
418*570de38fSSurya Prakki 			(void) printf(KPS_HDR_FMT, DRKPS_HDR_TXT);
419fcf3ce44SJohn Forte 		} else
420*570de38fSSurya Prakki 			(void) printf(KPS_HDR_FMT, RKPS_HDR_TXT);
421fcf3ce44SJohn Forte 
422*570de38fSSurya Prakki 		(void) printf(TPS_HDR_FMT, RTPS_HDR_TXT);
423fcf3ce44SJohn Forte 	}
424fcf3ce44SJohn Forte 
425fcf3ce44SJohn Forte 	if (dflags & WRITE) {
426fcf3ce44SJohn Forte 		if ((mode & MULTI) && (mode & SDBC)) {
427*570de38fSSurya Prakki 			(void) printf(KPS_HDR_FMT, CWKPS_HDR_TXT);
428*570de38fSSurya Prakki 			(void) printf(KPS_HDR_FMT, DWKPS_HDR_TXT);
429fcf3ce44SJohn Forte 		} else
430*570de38fSSurya Prakki 			(void) printf(KPS_HDR_FMT, WKPS_HDR_TXT);
431fcf3ce44SJohn Forte 
432*570de38fSSurya Prakki 		(void) printf(TPS_HDR_FMT, WTPS_HDR_TXT);
433fcf3ce44SJohn Forte 	}
434fcf3ce44SJohn Forte 
435fcf3ce44SJohn Forte 	if (dflags & TIMING)
436*570de38fSSurya Prakki 		(void) printf(SVT_HDR_FMT, SVT_HDR_TXT);
437fcf3ce44SJohn Forte 
438fcf3ce44SJohn Forte 	(void) printf("\n");
439fcf3ce44SJohn Forte }
440