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

Collapse All | Expand All

(-)usr.sbin/iostat/iostat.c (-9 / +9 lines)
Lines 797-803 Link Here
797
	long double total_mb, blocks_per_second, total_duration;
797
	long double total_mb, blocks_per_second, total_duration;
798
	long double ms_per_other, ms_per_read, ms_per_write, ms_per_transaction;
798
	long double ms_per_other, ms_per_read, ms_per_write, ms_per_transaction;
799
	int firstline = 1;
799
	int firstline = 1;
800
	char *devname;
800
	char *dev_name;
801
801
802
	if (xflag > 0) {
802
	if (xflag > 0) {
803
		printf("                        extended device statistics  ");
803
		printf("                        extended device statistics  ");
Lines 871-877 Link Here
871
		}
871
		}
872
872
873
		if (xflag > 0) {
873
		if (xflag > 0) {
874
			if (asprintf(&devname, "%s%d",
874
			if (asprintf(&dev_name, "%s%d",
875
			    cur.dinfo->devices[di].device_name,
875
			    cur.dinfo->devices[di].device_name,
876
			    cur.dinfo->devices[di].unit_number) == -1)
876
			    cur.dinfo->devices[di].unit_number) == -1)
877
				err(1, "asprintf");
877
				err(1, "asprintf");
Lines 887-893 Link Here
887
					printf("%-8.8s %5d %5d %8.1Lf "
887
					printf("%-8.8s %5d %5d %8.1Lf "
888
					    "%8.1Lf %5d %5d %5d %5d "
888
					    "%8.1Lf %5d %5d %5d %5d "
889
					    "%4" PRIu64 " %3.0Lf ",
889
					    "%4" PRIu64 " %3.0Lf ",
890
					    devname,
890
					    dev_name,
891
					    (int)transfers_per_second_read,
891
					    (int)transfers_per_second_read,
892
					    (int)transfers_per_second_write,
892
					    (int)transfers_per_second_write,
893
					    mb_per_second_read * 1024,
893
					    mb_per_second_read * 1024,
Lines 900-906 Link Here
900
					printf("%-8.8s %11.1Lf %11.1Lf "
900
					printf("%-8.8s %11.1Lf %11.1Lf "
901
					    "%12.1Lf %12.1Lf %4" PRIu64
901
					    "%12.1Lf %12.1Lf %4" PRIu64
902
					    " %10.1Lf %9.1Lf ",
902
					    " %10.1Lf %9.1Lf ",
903
					    devname,
903
					    dev_name,
904
					    (long double)total_transfers_read,
904
					    (long double)total_transfers_read,
905
					    (long double)total_transfers_write,
905
					    (long double)total_transfers_write,
906
					    (long double)
906
					    (long double)
Lines 925-931 Link Here
925
				}
925
				}
926
				printf("\n");
926
				printf("\n");
927
			}
927
			}
928
			free(devname);
928
			free(dev_name);
929
		} else if (oflag > 0) {
929
		} else if (oflag > 0) {
930
			int msdig = (ms_per_transaction < 100.0) ? 1 : 0;
930
			int msdig = (ms_per_transaction < 100.0) ? 1 : 0;
931
931
Lines 979-993 Link Here
979
cpustats(void)
979
cpustats(void)
980
{
980
{
981
	int state;
981
	int state;
982
	double time;
982
	double total;
983
983
984
	time = 0.0;
984
	total = 0.0;
985
985
986
	for (state = 0; state < CPUSTATES; ++state)
986
	for (state = 0; state < CPUSTATES; ++state)
987
		time += cur.cp_time[state];
987
		total += cur.cp_time[state];
988
	for (state = 0; state < CPUSTATES; ++state)
988
	for (state = 0; state < CPUSTATES; ++state)
989
		printf(" %2.0f",
989
		printf(" %2.0f",
990
		       rint(100. * cur.cp_time[state] / (time ? time : 1)));
990
		       rint(100. * cur.cp_time[state] / (total ? total : 1)));
991
}
991
}
992
992
993
static int
993
static int

Return to bug 207378