View | Details | Raw Unified | Return to bug 212726 | Differences between
and this patch

Collapse All | Expand All

(-)gstat.8 (-1 / +7 lines)
Lines 32-38 Link Here
32
.Nd print statistics about GEOM disks
32
.Nd print statistics about GEOM disks
33
.Sh SYNOPSIS
33
.Sh SYNOPSIS
34
.Nm
34
.Nm
35
.Op Fl abcdop
35
.Op Fl abBcdops
36
.Op Fl f Ar filter
36
.Op Fl f Ar filter
37
.Op Fl I Ar interval
37
.Op Fl I Ar interval
38
.Sh DESCRIPTION
38
.Sh DESCRIPTION
Lines 50-55 Link Here
50
Batch mode.
50
Batch mode.
51
Collect numbers, print and exit.
51
Collect numbers, print and exit.
52
Default if stdout is not a tty.
52
Default if stdout is not a tty.
53
.It Fl B
54
Endless batch mode.
55
Same as batch mode, but dont exit after collecting
56
the first set of data.
53
.It Fl c
57
.It Fl c
54
Enable display of
58
Enable display of
55
.Xr geom 4
59
.Xr geom 4
Lines 72-77 Link Here
72
.It Fl o
76
.It Fl o
73
Enable display of statistics for other operations
77
Enable display of statistics for other operations
74
.Pq Dv BIO_FLUSH .
78
.Pq Dv BIO_FLUSH .
79
.It Fl s
80
Enable blocks' size statistics.
75
.It Fl I Ar interval
81
.It Fl I Ar interval
76
Refresh the
82
Refresh the
77
.Nm
83
.Nm
(-)gstat.c (-10 / +41 lines)
Lines 51-61 Link Here
51
#include <sysexits.h>
51
#include <sysexits.h>
52
#include <unistd.h>
52
#include <unistd.h>
53
53
54
static int flag_a, flag_b, flag_c, flag_d, flag_o, flag_p;
54
static int flag_a, flag_b, flag_B, flag_c, flag_d, flag_o, flag_p, flag_s;
55
static int flag_I = 1000000;
55
static int flag_I = 1000000;
56
56
57
#define PRINTMSG(...) do {						\
57
#define PRINTMSG(...) do {						\
58
		if (flag_b && !loop)					\
58
		if ((flag_b && !loop) || (flag_B))			\
59
			printf(__VA_ARGS__);				\
59
			printf(__VA_ARGS__);				\
60
		else if (!flag_b)					\
60
		else if (!flag_b)					\
61
			printw(__VA_ARGS__);				\
61
			printw(__VA_ARGS__);				\
Lines 88-94 Link Here
88
	char *p;
88
	char *p;
89
	char f_s[100], pf_s[100], tmp_f_s[100];
89
	char f_s[100], pf_s[100], tmp_f_s[100];
90
	const char *line;
90
	const char *line;
91
	long double ld[13];
91
	long double ld[16];
92
	uint64_t u64;
92
	uint64_t u64;
93
	EditLine *el;
93
	EditLine *el;
94
	History *hist;
94
	History *hist;
Lines 104-110 Link Here
104
		flag_b = 1;
104
		flag_b = 1;
105
105
106
	f_s[0] = '\0';
106
	f_s[0] = '\0';
107
	while ((i = getopt(argc, argv, "abdcf:I:op")) != -1) {
107
	while ((i = getopt(argc, argv, "abBdcf:I:ops")) != -1) {
108
		switch (i) {
108
		switch (i) {
109
		case 'a':
109
		case 'a':
110
			flag_a = 1;
110
			flag_a = 1;
Lines 112-117 Link Here
112
		case 'b':
112
		case 'b':
113
			flag_b = 1;
113
			flag_b = 1;
114
			break;
114
			break;
115
		case 'B':
116
			flag_B = 1;
117
			flag_b = 1;
118
			break;
115
		case 'c':
119
		case 'c':
116
			flag_c = 1;
120
			flag_c = 1;
117
			break;
121
			break;
Lines 146-151 Link Here
146
		case 'p':
150
		case 'p':
147
			flag_p = 1;
151
			flag_p = 1;
148
			break;
152
			break;
153
		case 's':
154
			flag_s = 1;
155
			break;
149
		case '?':
156
		case '?':
150
		default:
157
		default:
151
			usage();
158
			usage();
Lines 208-214 Link Here
208
	
215
	
209
		geom_stats_snapshot_reset(sp);
216
		geom_stats_snapshot_reset(sp);
210
		geom_stats_snapshot_reset(sq);
217
		geom_stats_snapshot_reset(sq);
211
		move(0,0);
218
		if (!flag_b)
219
			move(0,0);
212
		PRINTMSG("dT: %5.3fs  w: %.3fs", dt, (float)flag_I / 1000000);
220
		PRINTMSG("dT: %5.3fs  w: %.3fs", dt, (float)flag_I / 1000000);
213
		if (f_s[0] != '\0') {
221
		if (f_s[0] != '\0') {
214
			PRINTMSG("  filter: ");
222
			PRINTMSG("  filter: ");
Lines 231-240 Link Here
231
		}
239
		}
232
		PRINTMSG("\n");
240
		PRINTMSG("\n");
233
		PRINTMSG(" L(q)  ops/s   ");
241
		PRINTMSG(" L(q)  ops/s   ");
234
		PRINTMSG(" r/s   kBps   ms/r   ");
242
		if (flag_s) {
235
		PRINTMSG(" w/s   kBps   ms/w   ");
243
			PRINTMSG(" r/s     kB   kBps   ms/r   ");
236
		if (flag_d)
244
			PRINTMSG(" w/s     kB   kBps   ms/w   ");
237
			PRINTMSG(" d/s   kBps   ms/d   ");
245
		}
246
		else {
247
			PRINTMSG(" r/s   kBps   ms/r   ");
248
			PRINTMSG(" w/s   kBps   ms/w   ");
249
		}
250
		if (flag_d) {
251
			if (flag_s)
252
				PRINTMSG(" d/s     kB   kBps   ms/d   ");
253
			else
254
				PRINTMSG(" d/s   kBps   ms/d   ");
255
		}
238
		if (flag_o)
256
		if (flag_o)
239
			PRINTMSG(" o/s   ms/o   ");
257
			PRINTMSG(" o/s   ms/o   ");
240
		PRINTMSG("%%busy Name\n");
258
		PRINTMSG("%%busy Name\n");
Lines 298-303 Link Here
298
			    DSM_TRANSFERS_PER_SECOND_OTHER, &ld[11],
316
			    DSM_TRANSFERS_PER_SECOND_OTHER, &ld[11],
299
			    DSM_MS_PER_TRANSACTION_OTHER, &ld[12],
317
			    DSM_MS_PER_TRANSACTION_OTHER, &ld[12],
300
318
319
			    DSM_KB_PER_TRANSFER_READ, &ld[13],
320
			    DSM_KB_PER_TRANSFER_WRITE, &ld[14],
321
			    DSM_KB_PER_TRANSFER_FREE, &ld[15],
322
301
			    DSM_NONE);
323
			    DSM_NONE);
302
324
303
			if (flag_a && ld[7] < 0.1) {
325
			if (flag_a && ld[7] < 0.1) {
Lines 308-319 Link Here
308
			PRINTMSG(" %4ju", (uintmax_t)u64);
330
			PRINTMSG(" %4ju", (uintmax_t)u64);
309
			PRINTMSG(" %6.0f", (double)ld[0]);
331
			PRINTMSG(" %6.0f", (double)ld[0]);
310
			PRINTMSG(" %6.0f", (double)ld[1]);
332
			PRINTMSG(" %6.0f", (double)ld[1]);
333
			if (flag_s)
334
				PRINTMSG(" %6.0f", (double)ld[13]);
311
			PRINTMSG(" %6.0f", (double)ld[2] * 1024);
335
			PRINTMSG(" %6.0f", (double)ld[2] * 1024);
312
			if (ld[3] > 1e3) 
336
			if (ld[3] > 1e3) 
313
				PRINTMSG(" %6.0f", (double)ld[3]);
337
				PRINTMSG(" %6.0f", (double)ld[3]);
314
			else
338
			else
315
				PRINTMSG(" %6.1f", (double)ld[3]);
339
				PRINTMSG(" %6.1f", (double)ld[3]);
316
			PRINTMSG(" %6.0f", (double)ld[4]);
340
			PRINTMSG(" %6.0f", (double)ld[4]);
341
			if (flag_s)
342
				PRINTMSG(" %6.0f", (double)ld[14]);
317
			PRINTMSG(" %6.0f", (double)ld[5] * 1024);
343
			PRINTMSG(" %6.0f", (double)ld[5] * 1024);
318
			if (ld[6] > 1e3) 
344
			if (ld[6] > 1e3) 
319
				PRINTMSG(" %6.0f", (double)ld[6]);
345
				PRINTMSG(" %6.0f", (double)ld[6]);
Lines 322-327 Link Here
322
348
323
			if (flag_d) {
349
			if (flag_d) {
324
				PRINTMSG(" %6.0f", (double)ld[8]);
350
				PRINTMSG(" %6.0f", (double)ld[8]);
351
				if (flag_s)
352
					PRINTMSG(" %6.0f", (double)ld[15]);
325
				PRINTMSG(" %6.0f", (double)ld[9] * 1024);
353
				PRINTMSG(" %6.0f", (double)ld[9] * 1024);
326
				if (ld[10] > 1e3) 
354
				if (ld[10] > 1e3) 
327
					PRINTMSG(" %6.0f", (double)ld[10]);
355
					PRINTMSG(" %6.0f", (double)ld[10]);
Lines 373-379 Link Here
373
			/* We loop extra to make sure we get the information. */
401
			/* We loop extra to make sure we get the information. */
374
			if (!loop)
402
			if (!loop)
375
				break;
403
				break;
376
			loop = 0;
404
			if (!flag_B)
405
				loop = 0;
406
			else
407
				fflush(stdout);
377
			usleep(flag_I);
408
			usleep(flag_I);
378
			continue;
409
			continue;
379
		}
410
		}

Return to bug 212726