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

Collapse All | Expand All

(-)gstat/gstat.8 (-1 / +5 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 abBcdop
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
(-)gstat/gstat.c (-5 / +15 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_c, flag_d, flag_o, flag_p, flag_B;
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 99-110 Link Here
99
	maxx = -1;
99
	maxx = -1;
100
	curx = -1;
100
	curx = -1;
101
	loop = 1;
101
	loop = 1;
102
		
102
	/* Turn on batch mode if output is not tty. */
103
	/* Turn on batch mode if output is not tty. */
103
	if (!isatty(fileno(stdout)))
104
	if (!isatty(fileno(stdout)))
104
		flag_b = 1;
105
		flag_b = 1;
105
106
106
	f_s[0] = '\0';
107
	f_s[0] = '\0';
107
	while ((i = getopt(argc, argv, "abdcf:I:op")) != -1) {
108
	while ((i = getopt(argc, argv, "abBdcf:I:op")) != -1) {
108
		switch (i) {
109
		switch (i) {
109
		case 'a':
110
		case 'a':
110
			flag_a = 1;
111
			flag_a = 1;
Lines 112-117 Link Here
112
		case 'b':
113
		case 'b':
113
			flag_b = 1;
114
			flag_b = 1;
114
			break;
115
			break;
116
		case 'B':
117
			flag_B = 1;
118
			flag_b = 1;
119
			break;
115
		case 'c':
120
		case 'c':
116
			flag_c = 1;
121
			flag_c = 1;
117
			break;
122
			break;
Lines 208-214 Link Here
208
	
213
	
209
		geom_stats_snapshot_reset(sp);
214
		geom_stats_snapshot_reset(sp);
210
		geom_stats_snapshot_reset(sq);
215
		geom_stats_snapshot_reset(sq);
211
		move(0,0);
216
		if (!flag_b)
217
			move(0,0);
218
212
		PRINTMSG("dT: %5.3fs  w: %.3fs", dt, (float)flag_I / 1000000);
219
		PRINTMSG("dT: %5.3fs  w: %.3fs", dt, (float)flag_I / 1000000);
213
		if (f_s[0] != '\0') {
220
		if (f_s[0] != '\0') {
214
			PRINTMSG("  filter: ");
221
			PRINTMSG("  filter: ");
Lines 366-371 Link Here
366
			if (!flag_b)
373
			if (!flag_b)
367
				clrtoeol();
374
				clrtoeol();
368
			PRINTMSG("\n");
375
			PRINTMSG("\n");
376
			if (flag_B) 
377
				fflush(stdout);
369
			*gsq = *gsp;
378
			*gsq = *gsp;
370
		}
379
		}
371
		geom_stats_snapshot_free(sp);
380
		geom_stats_snapshot_free(sp);
Lines 373-379 Link Here
373
			/* We loop extra to make sure we get the information. */
382
			/* We loop extra to make sure we get the information. */
374
			if (!loop)
383
			if (!loop)
375
				break;
384
				break;
376
			loop = 0;
385
			if (!flag_B)
386
				loop = 0;
377
			usleep(flag_I);
387
			usleep(flag_I);
378
			continue;
388
			continue;
379
		}
389
		}

Return to bug 198347