Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/iostat/iostat.c
Show First 20 Lines • Show All 796 Lines • ▼ Show 20 Lines | devstats(int perf_select, long double etime, int havelast) | ||||
long double busy_pct, busy_time; | long double busy_pct, busy_time; | ||||
u_int64_t queue_len; | u_int64_t queue_len; | ||||
long double total_mb, blocks_per_second, total_duration; | long double total_mb, blocks_per_second, total_duration; | ||||
long double ms_per_other, ms_per_read, ms_per_write, ms_per_transaction; | long double ms_per_other, ms_per_read, ms_per_write, ms_per_transaction; | ||||
int firstline = 1; | int firstline = 1; | ||||
char *devicename; | char *devicename; | ||||
if (xflag > 0) { | if (xflag > 0) { | ||||
if (Cflag > 0) { | |||||
printf(" cpu\n"); | |||||
printf(" us ni sy in id\n"); | |||||
cpustats(); | |||||
printf("\n"); | |||||
} | |||||
printf(" extended device statistics "); | printf(" extended device statistics "); | ||||
if (Tflag > 0) | if (Tflag > 0) | ||||
printf(" tty "); | printf(" tty "); | ||||
if (Cflag > 0) | |||||
printf(" cpu "); | |||||
printf("\n"); | printf("\n"); | ||||
if (Iflag == 0) { | if (Iflag == 0) { | ||||
printf("device r/s w/s kr/s kw/s " | printf("device r/s w/s kr/s kw/s " | ||||
" ms/r ms/w ms/o ms/t qlen %%b "); | " ms/r ms/w ms/o ms/t qlen %%b "); | ||||
} else { | } else { | ||||
printf("device r/i w/i kr/i" | printf("device r/i w/i kr/i" | ||||
" kw/i qlen tsvc_t/i sb/i "); | " kw/i qlen tsvc_t/i sb/i "); | ||||
} | } | ||||
if (Tflag > 0) | if (Tflag > 0) | ||||
printf("tin tout "); | printf("tin tout "); | ||||
if (Cflag > 0) | |||||
printf("us ni sy in id "); | |||||
printf("\n"); | printf("\n"); | ||||
} | } | ||||
for (dn = 0; dn < num_devices; dn++) { | for (dn = 0; dn < num_devices; dn++) { | ||||
int di; | int di; | ||||
if (((perf_select == 0) && (dev_select[dn].selected == 0)) | if (((perf_select == 0) && (dev_select[dn].selected == 0)) | ||||
|| (dev_select[dn].selected > maxshowdevs)) | || (dev_select[dn].selected > maxshowdevs)) | ||||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | if (xflag > 0) { | ||||
* we're printing, also print | * we're printing, also print | ||||
* CPU or TTY stats if requested. | * CPU or TTY stats if requested. | ||||
*/ | */ | ||||
firstline = 0; | firstline = 0; | ||||
if (Tflag > 0) | if (Tflag > 0) | ||||
printf("%4.0Lf%5.0Lf", | printf("%4.0Lf%5.0Lf", | ||||
cur.tk_nin / etime, | cur.tk_nin / etime, | ||||
cur.tk_nout / etime); | cur.tk_nout / etime); | ||||
if (Cflag > 0) | |||||
cpustats(); | |||||
} | } | ||||
printf("\n"); | printf("\n"); | ||||
} | } | ||||
free(devicename); | free(devicename); | ||||
} else if (oflag > 0) { | } else if (oflag > 0) { | ||||
int msdig = (ms_per_transaction < 100.0) ? 1 : 0; | int msdig = (ms_per_transaction < 100.0) ? 1 : 0; | ||||
if (Iflag == 0) | if (Iflag == 0) | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |