diff options
author | Christiano F. Haesbaert <haesbaert@cvs.openbsd.org> | 2011-10-01 06:23:54 +0000 |
---|---|---|
committer | Christiano F. Haesbaert <haesbaert@cvs.openbsd.org> | 2011-10-01 06:23:54 +0000 |
commit | 297d4884d3a6da01c77fada96734b7c4cdb9df8b (patch) | |
tree | f13eb101d05825c0c705f287d6a3c7d70689e455 /usr.bin | |
parent | 33f701d6293ea7240f7d41a939754e2131c18c26 (diff) |
Sort the lines on -l output and match the order on the column output.
Also make the -l output go to stdout as it's easier to grep with it,
and set stdout to linebuf.
ok djm@ "as long as you add a setlinebuf(stdout) :-)"
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tcpbench/tcpbench.c | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/usr.bin/tcpbench/tcpbench.c b/usr.bin/tcpbench/tcpbench.c index a5fb1efdd1b..a794996bef2 100644 --- a/usr.bin/tcpbench/tcpbench.c +++ b/usr.bin/tcpbench/tcpbench.c @@ -134,36 +134,36 @@ static struct { static const char *allowed_kvars[] = { "inpcb.inp_flags", "sockb.so_rcv.sb_cc", - "sockb.so_rcv.sb_wat", "sockb.so_rcv.sb_hiwat", + "sockb.so_rcv.sb_wat", "sockb.so_snd.sb_cc", - "sockb.so_snd.sb_wat", "sockb.so_snd.sb_hiwat", - "tcpcb.snd_una", + "sockb.so_snd.sb_wat", + "tcpcb.last_ack_sent", + "tcpcb.max_sndwnd", + "tcpcb.rcv_adv", + "tcpcb.rcv_nxt", + "tcpcb.rcv_scale", + "tcpcb.rcv_wnd", + "tcpcb.rfbuf_cnt", + "tcpcb.rfbuf_ts", + "tcpcb.snd_cwnd", + "tcpcb.snd_max", "tcpcb.snd_nxt", + "tcpcb.snd_scale", + "tcpcb.snd_ssthresh", + "tcpcb.snd_una", "tcpcb.snd_wl1", "tcpcb.snd_wl2", "tcpcb.snd_wnd", - "tcpcb.rcv_wnd", - "tcpcb.rcv_nxt", - "tcpcb.rcv_adv", - "tcpcb.snd_max", - "tcpcb.snd_cwnd", - "tcpcb.snd_ssthresh", "tcpcb.t_rcvtime", - "tcpcb.t_rtttime", "tcpcb.t_rtseq", - "tcpcb.t_srtt", - "tcpcb.t_rttvar", "tcpcb.t_rttmin", - "tcpcb.max_sndwnd", - "tcpcb.snd_scale", - "tcpcb.rcv_scale", - "tcpcb.last_ack_sent", - "tcpcb.rfbuf_cnt", - "tcpcb.rfbuf_ts", - "tcpcb.ts_recent_age", + "tcpcb.t_rtttime", + "tcpcb.t_rttvar", + "tcpcb.t_srtt", "tcpcb.ts_recent", + "tcpcb.ts_recent_age", NULL }; @@ -427,9 +427,9 @@ list_kvars(void) { u_int i; - fprintf(stderr, "Supported kernel variables:\n"); + printf("Supported kernel variables:\n"); for (i = 0; allowed_kvars[i] != NULL; i++) - fprintf(stderr, "\t%s\n", allowed_kvars[i]); + printf("\t%s\n", allowed_kvars[i]); } static char ** @@ -486,36 +486,36 @@ tcp_stats_display(unsigned long long total_elapsed, long double mbps, } P(inpcb, inp_flags, "0x%08x") P(sockb, so_rcv.sb_cc, "%lu") - P(sockb, so_rcv.sb_wat, "%lu") P(sockb, so_rcv.sb_hiwat, "%lu") + P(sockb, so_rcv.sb_wat, "%lu") P(sockb, so_snd.sb_cc, "%lu") - P(sockb, so_snd.sb_wat, "%lu") P(sockb, so_snd.sb_hiwat, "%lu") - P(tcpcb, snd_una, "%u") + P(sockb, so_snd.sb_wat, "%lu") + P(tcpcb, last_ack_sent, "%u") + P(tcpcb, max_sndwnd, "%lu") + P(tcpcb, rcv_adv, "%u") + P(tcpcb, rcv_nxt, "%u") + P(tcpcb, rcv_scale, "%u") + P(tcpcb, rcv_wnd, "%lu") + P(tcpcb, rfbuf_cnt, "%u") + P(tcpcb, rfbuf_ts, "%u") + P(tcpcb, snd_cwnd, "%lu") + P(tcpcb, snd_max, "%u") P(tcpcb, snd_nxt, "%u") + P(tcpcb, snd_scale, "%u") + P(tcpcb, snd_ssthresh, "%lu") + P(tcpcb, snd_una, "%u") P(tcpcb, snd_wl1, "%u") P(tcpcb, snd_wl2, "%u") P(tcpcb, snd_wnd, "%lu") - P(tcpcb, rcv_wnd, "%lu") - P(tcpcb, rcv_nxt, "%u") - P(tcpcb, rcv_adv, "%u") - P(tcpcb, snd_max, "%u") - P(tcpcb, snd_cwnd, "%lu") - P(tcpcb, snd_ssthresh, "%lu") P(tcpcb, t_rcvtime, "%u") - P(tcpcb, t_rtttime, "%u") P(tcpcb, t_rtseq, "%u") - P(tcpcb, t_srtt, "%hu") - P(tcpcb, t_rttvar, "%hu") P(tcpcb, t_rttmin, "%hu") - P(tcpcb, max_sndwnd, "%lu") - P(tcpcb, snd_scale, "%u") - P(tcpcb, rcv_scale, "%u") - P(tcpcb, last_ack_sent, "%u") - P(tcpcb, rfbuf_cnt, "%u") - P(tcpcb, rfbuf_ts, "%u") - P(tcpcb, ts_recent_age, "%u") + P(tcpcb, t_rtttime, "%u") + P(tcpcb, t_rttvar, "%hu") + P(tcpcb, t_srtt, "%hu") P(tcpcb, ts_recent, "%u") + P(tcpcb, ts_recent_age, "%u") #undef S #undef P } @@ -985,6 +985,7 @@ main(int argc, char **argv) struct statctx *udp_sc = NULL; /* Init world */ + setlinebuf(stdout); ptb = &tcpbench; ptb->dummybuf_len = 0; ptb->Sflag = ptb->sflag = ptb->vflag = ptb->Vflag = 0; |