Bug #1698
closediostat patch: Add dillon's systat changes to iostat
0%
Description
Please review the attached patch.
Jan
begin 644 iostat.diff
M9&EF9B`M+6=I="!A+W5S<BYS8FEN+VEO
M,#8T-`HM+2T@82]U<W(N
M;BAI;G0@87)G8RP@8VAA<B`J*F%R9W8I"B`)"0EC<%]T:6UE7W1O=&%L(#T@
M,2XP.PH@"B`)"6EF("H9&9L86<
/3T@,"D@?'P@*%1F;&%G(#X@,"DI"BT)
M"0EP<FEN=&8H(B4T+C!F)34N,&8B+"!D:69F7W1K7VYI;B`O(&-P7W1I;65?
M=&]T86P@*B`Q938L<')I;G1F*"(E-"XP9B4U+C!F("(L(&1I9F9?
M=&M?;FEN("\8W!?=&EM95]T;W1A;"`J(#%E-BP
"B`)"0D)9&EF9E]T:U]N
M;W5T("\8W!?=&EM95]T;W1A;"`J(#%E-BD["B`)"61E=G-T871S*&AF;&%G
"AD9FQA9R`]/2`P*2!\?"`H0V9L86<
M*3L*(`D):68/B`P*2D*0$`
30Y
M,2PW("LT.3$L-R!`0"!P:&1R]?=6YU<V5D(&EN="!S:6=N;RD*(`EI;G0@
M<')I;G1E9#L*(`H@"6EF("H9&9L86<
/3T@,"D@?'P@*%1F;x%x%G(#X@,"DI
M"BT)"7!R:6YT9B@B("`("`
='1Y(BD["BL)"7!R:6YT9B@B("`('1T>2(I
"69O<B`H:2`](#`L('!R:6YT960],#LH:2`\(&YU;5]D979I8V5S*2`F
M.PH
M)B`H<')I;G1E9"`\(&UA>'-H;W=D979S*3MI*RLI>PH@"0EI;G0@9&D["B`)
M"6EF("H9&5V7W-E;&5C=%MI72YS96QE8W1E9"`A/2`P*0I`0"`M-3`R+#$T
<&AD
M("LU,#(L,30@0$`
M("!C=7(N9&EN9F\M/F1E=FEC97-;9&E=+F1E=FEC95]N86UE+`H"0D)"0D@
M("`8W5R+F1I;F9O+3YD979I8V5S6V1I72YU;FET7VYU;6)E<BD["B`)"0EE
("`
M;'-E"BT)"0D)<')I;G1F*"(E,34N-G,E9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6YT('!E
=')A;G-F97)S
)G1R86YS9F5R
M)FQA<W0N9&EN9F\M/F1E=FEC97-;9&E=+"!B=7-Y7W-E8V]N9',L"B`)"0D)
M("`F=&]T86Q?8GET97,L("9T;W1A;%]T<F%N
M<U]P97)?
M97)S7W!E<E]S96-O;F0L?
M<U]P97)?
M<W1A='-?
M="YD:6YF;RT^9&5V:6-E<UMD:5TL(&)U
M<V5C;VYD
M9F5R<U]P97)?
M6V1N72YB>71E<R`]('1O=&%L7V)Y=&5S.PI`0"`M-C`T+#$P("LV,C$L,3(
("!M8E]P97)?
M0$`@9&5V<W1A=',H:6YT('!E("`
("!MM97)?=')A;G-A8W1I;VXI.PH@"0E](&5L<V4@>PH@"0D):68@*$EF;&%G(#T]
M(#`I"BT)"0D)<')I;G1F*"()34N,DQF("4T+C!,9B`E-2XR3&8
(BP**PD)
M"0EP<FEN=&8H(B`E-2XR3&8@)30N,$QF,9B`E-"XP3&8@)38N,DQF
M("`B+`H@"0D)"2`("`
("!K8E]P97)?=')A;G-F97"0D)("`("`
M('1R86YS9F5R<U]P97)?("`
=')A;G-F97)S7W!E<E]S96-O;F1R+`HK"0D)
M"2`("`
("!M8E]P97)?<V5C;VYD
M7W!E<E]S96-O;F1W+`HK"0D)"2`("`
("!M8E]P97)?
7=&%L7VUB("\](#$P,C0@*B`Q,#(T.PH`
`
end
Updated by lentferj almost 15 years ago
for easier reviewing, inline:
diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c
index 5398ce1..af016b7 100644
--- a/usr.sbin/iostat/iostat.c
+++ b/usr.sbin/iostat/iostat.c@ -467,7 +467,7
@ main(int argc, char **argv)
cp_time_total = 1.0;
if ((dflag 0) || (Tflag > 0))
- printf("%4.0f%5.0f", diff_tk_nin / cp_time_total * 1e6,
+ printf("%4.0f%5.0f ", diff_tk_nin / cp_time_total * 1e6,
diff_tk_nout / cp_time_total * 1e6);
devstats(hflag);
if ((dflag 0) || (Cflag > 0))
@ -491,7 +491,7
@ phdr(__unused int signo)
int printed;
if ((dflag == 0) || (Tflag > 0))
- printf(" tty");
+ printf(" tty");
for (i = 0, printed=0;(i < num_devices) && (printed < maxshowdevs);i++){
int di;
if ((dev_select[i].selected != 0)
@ -502,14 +502,14
@ phdr(__unused int signo)
cur.dinfo->devices[di].device_name,
cur.dinfo->devices[di].unit_number);
else
- printf("%15.6s%d ",
+ printf("%19.6s%d ",
cur.dinfo->devices[di].device_name,
cur.dinfo->devices[di].unit_number);
printed++;
}
}
if ((dflag 0) || (Cflag > 0))
- printf(" cpu\n");
+ printf(" cpu\n");
else
printf("\n");
@ -526,7 +526,7
@ phdr(_unused int signo)
printf(" blk xfr msps ");
} else {
if (Iflag 0)
- printf(" KB/t tps MB/s ");
+ printf(" KB/t rtps MBr/s wtps MBw/s ");
else
printf(" KB/t xfrs MB ");
}@ -534,7 +534,7
@ phdr(_unused int signo)
}
}
if ((dflag == 0) || (Cflag > 0))
- printf(" us ni sy in id\n");
+ printf(" us ni sy in id\n");
else
printf("\n");
@ -544,8 +544,11
@ static void
devstats(int perf_select)
{
int dn;
+ long double kb_per_transfer;
long double transfers_per_second;
- long double kb_per_transfer, mb_per_second;
+ long double transfers_per_secondr, transfers_per_secondw;
+ long double mb_per_second;
+ long double mb_per_secondr, mb_per_secondw;
u_int64_t total_bytes, total_transfers, total_blocks;
long double busy_seconds;
long double total_mb;@ -570,9 +573,23
@ devstats(int perf_select)
&last.dinfo->devices[di], busy_seconds,
&total_bytes, &total_transfers,
&total_blocks, &kb_per_transfer,
- &transfers_per_second, &mb_per_second,
+ &transfers_per_second, &mb_per_second,
&blocks_per_second, &ms_per_transaction)!= 0)
errx(1, "%s", devstat_errbuf);
+ if (compute_stats_read(&cur.dinfo->devices[di],
+ &last.dinfo->devices[di], busy_seconds,
+ NULL, NULL,
+ NULL, NULL,
+ &transfers_per_secondr, &mb_per_secondr,
+ NULL, NULL)!= 0)
+ errx(1, "%s", devstat_errbuf);
+ if (compute_stats_write(&cur.dinfo->devices[di],
+ &last.dinfo->devices[di], busy_seconds,
+ NULL, NULL,
+ NULL, NULL,
+ &transfers_per_secondw, &mb_per_secondw,
+ NULL, NULL)!= 0)
+ errx(1, "%s", devstat_errbuf);
if (perf_select != 0) {
dev_select[dn].bytes = total_bytes;
@ -604,10 +621,12
@ devstats(int perf_select)
ms_per_transaction);
} else {
if (Iflag == 0)
- printf(" %5.2Lf %4.0Lf %5.2Lf ",
+ printf(" %5.2Lf %4.0Lf %6.2Lf %4.0Lf %6.2Lf ",
kb_per_transfer,
- transfers_per_second,
- mb_per_second);
+ transfers_per_secondr,
+ mb_per_secondr,
+ transfers_per_secondw,
+ mb_per_secondw);
else {
total_mb = total_bytes;
total_mb /= 1024 * 1024;
Updated by dillon almost 15 years ago
:for easier reviewing, inline:
:
:diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c
For some reason the patch command on that diff file fails on every chunk,
not sure why.
In anycase, I see where it is headed. I think we might have an issue
with too much information reducing the number of devices which can be
displayed, so I'd like to suggest some other changes:
- Provide options for various modes, with the default being the old
(KB/t, tps, MB/s) tuple, so the output can remain compact.
I recommend one that does (tps, MBr/s, MBw/s).
- Maybe we can remove the tty statistics and add aggregate or
primary interface network statistics. Nobody cares about tty
statistics any more but it would be kinda cool to see network
stats there mixed with the disk stats.
I am considering removing the tps/r, tps/w from systat -vm 1 and
just having tps, but keeping MBs/r and MBs/w. I think people will
get more out of an aggregate tps stat. Then for systat -vm 1
we would have: (KB/t, tps, MBs/r, MBs/w) (I should rename those to
MBr/s and MBw/s I guess too).
-Matt
Updated by lentferj almost 15 years ago
Matthew Dillon schrieb:
- Provide options for various modes, with the default being the old
(KB/t, tps, MB/s) tuple, so the output can remain compact.
I recommend one that does (tps, MBr/s, MBw/s).
Yeah, thought about that, too. Will look into it.
- Maybe we can remove the tty statistics and add aggregate or
primary interface network statistics. Nobody cares about tty
statistics any more but it would be kinda cool to see network
stats there mixed with the disk stats.
Can I get that from devstat also? Well, could just look at systat
-ifstat, right? How to determine the "primary" interface?
If you don't want to see tty (which I fully understand :-) ) you could
just use iostat -dC.
I am considering removing the tps/r, tps/w from systat -vm 1 and
just having tps, but keeping MBs/r and MBs/w. I think people will
get more out of an aggregate tps stat. Then for systat -vm 1
we would have: (KB/t, tps, MBs/r, MBs/w) (I should rename those to
MBr/s and MBw/s I guess too).
Yep, Megabyte-seconds divided by writes (and reads) doesn't make a
horrible lot of sense :-)
Jan
Updated by c.turner almost 15 years ago
Jan Lentfer wrote:
Matthew Dillon schrieb:
I am considering removing the tps/r, tps/w from systat -vm 1 and
just having tps, but keeping MBs/r and MBs/w. I think people will
get more out of an aggregate tps stat. Then for systat -vm 1
we would have: (KB/t, tps, MBs/r, MBs/w) (I should rename those to
MBr/s and MBw/s I guess too).
Just popped in my head - maybe some kind of format-string type of thing
might make sense here .. e.g:
VMSTAT_IOFMT="%k %t %R %W" -> KB/t tps MBs/r, MBs/w
with the default being set to whatever, and some sort of
'convention' r.e. what upper case vs lower case means
to make it intuitive..
no patch in attachments - sorry guys :)
</2c>