Show the load average in the tcp display (it was already shown, perhaps

not very usefully, in all other displays).  This was the original point
of the PR.

Move the load average up by 2 so that it starts in row 0 for all windows
(2 lines above it were wasted for all other windows except vmstat).
Move everything below it up by 2 or 3 (3 for icmp and icmp6 which had
an extra blank line due from not compensating for the foot-shooting in
note (3); only ip and ip6 compensated).  Reduce the magic numbers related
to this.

Notes by the submitter:
%%%
1. All the subwin() calls are identical using #define MAINWIN_ROW 3
    (systat.h).
2. The load average is at the top of the window.
3. Each display starts on the fourth line.  I made changes to those
    displays that shifted the start line (i.e., icmp).  This entailed a
    lot of changes within the comments at the top of those displays.
4. For ip6, I shifted the "Input next-header histogram" column down one
    row to separate it from "IPv6 Output".  I raised "bad scope packets"
    and "address selection failed" up one row to stay with "IPv6 Input"
    (valid?).  They were down one row to probably line up at the bottom,
    but I think they should stick with their fellow items in a column.
5. I condensed ifstat a bit.  It had a lot of empty rows.
%%%

Submitted by:	Se=E1n Farley <sean-freebsd at farley dot org>
PR:		bin/81874
This commit is contained in:
Bruce Evans 2006-04-30 04:26:46 +00:00
parent ef48b7b7e6
commit 8aa22952a9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=158160
14 changed files with 325 additions and 321 deletions

View File

@ -78,7 +78,7 @@ struct cmdtab cmdtab[] = {
#endif
{ "tcp", showtcp, fetchtcp, labeltcp,
inittcp, opentcp, closetcp, cmdmode,
resettcp, 0 },
resettcp, CF_LOADAV },
{ "ifstat", showifstat, fetchifstat, labelifstat,
initifstat, openifstat, closeifstat, cmdifstat,
0, CF_LOADAV },

View File

@ -66,25 +66,25 @@ static struct icmpstat icmpstat, initstat, oldstat;
/*-
--0 1 2 3 4 5 6 7
--0123456789012345678901234567890123456789012345678901234567890123456789012345
01 ICMP Input ICMP Output
02999999999 total messages 999999999 total messages
03999999999 with bad code 999999999 errors generated
04999999999 with bad length 999999999 suppressed - original too short
05999999999 with bad checksum 999999999 suppressed - original was ICMP
06999999999 with insufficient data 999999999 responses sent
07 999999999 suppressed - multicast echo
08 999999999 suppressed - multicast tstamp
09
10 Input Histogram Output Histogram
11999999999 echo response 999999999 echo response
12999999999 echo request 999999999 echo request
13999999999 destination unreachable 999999999 destination unreachable
14999999999 redirect 999999999 redirect
15999999999 time-to-live exceeded 999999999 time-to-line exceeded
16999999999 parameter problem 999999999 parameter problem
17999999999 router advertisement 999999999 router solicitation
00 ICMP Input ICMP Output
01999999999 total messages 999999999 total messages
02999999999 with bad code 999999999 errors generated
03999999999 with bad length 999999999 suppressed - original too short
04999999999 with bad checksum 999999999 suppressed - original was ICMP
05999999999 with insufficient data 999999999 responses sent
06 999999999 suppressed - multicast echo
07 999999999 suppressed - multicast tstamp
08
09 Input Histogram Output Histogram
10999999999 echo response 999999999 echo response
11999999999 echo request 999999999 echo request
12999999999 destination unreachable 999999999 destination unreachable
13999999999 redirect 999999999 redirect
14999999999 time-to-live exceeded 999999999 time-to-line exceeded
15999999999 parameter problem 999999999 parameter problem
16999999999 router advertisement 999999999 router solicitation
17
18
19
--0123456789012345678901234567890123456789012345678901234567890123456789012345
--0 1 2 3 4 5 6 7
*/
@ -92,7 +92,7 @@ static struct icmpstat icmpstat, initstat, oldstat;
WINDOW *
openicmp(void)
{
return (subwin(stdscr, LINES-5-1, 0, 5, 0));
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void
@ -112,23 +112,23 @@ labelicmp(void)
wmove(wnd, 0, 0); wclrtoeol(wnd);
#define L(row, str) mvwprintw(wnd, row, 10, str)
#define R(row, str) mvwprintw(wnd, row, 45, str);
L(1, "ICMP Input"); R(1, "ICMP Output");
L(2, "total messages"); R(2, "total messages");
L(3, "with bad code"); R(3, "errors generated");
L(4, "with bad length"); R(4, "suppressed - original too short");
L(5, "with bad checksum"); R(5, "suppressed - original was ICMP");
L(6, "with insufficient data"); R(6, "responses sent");
; R(7, "suppressed - multicast echo");
; R(8, "suppressed - multicast tstamp");
L(10, "Input Histogram"); R(10, "Output Histogram");
L(0, "ICMP Input"); R(0, "ICMP Output");
L(1, "total messages"); R(1, "total messages");
L(2, "with bad code"); R(2, "errors generated");
L(3, "with bad length"); R(3, "suppressed - original too short");
L(4, "with bad checksum"); R(4, "suppressed - original was ICMP");
L(5, "with insufficient data"); R(5, "responses sent");
R(6, "suppressed - multicast echo");
R(7, "suppressed - multicast tstamp");
L(9, "Input Histogram"); R(9, "Output Histogram");
#define B(row, str) L(row, str); R(row, str)
B(11, "echo response");
B(12, "echo request");
B(13, "destination unreachable");
B(14, "redirect");
B(15, "time-to-live exceeded");
B(16, "parameter problem");
L(17, "router advertisement"); R(17, "router solicitation");
B(10, "echo response");
B(11, "echo request");
B(12, "destination unreachable");
B(13, "redirect");
B(14, "time-to-live exceeded");
B(15, "parameter problem");
L(16, "router advertisement"); R(16, "router solicitation");
#undef L
#undef R
#undef B
@ -190,32 +190,32 @@ showicmp(void)
}
totalin += stats.icps_badcode + stats.icps_badlen +
stats.icps_checksum + stats.icps_tooshort;
mvwprintw(wnd, 2, 0, "%9lu", totalin);
mvwprintw(wnd, 2, 35, "%9lu", totalout);
mvwprintw(wnd, 1, 0, "%9lu", totalin);
mvwprintw(wnd, 1, 35, "%9lu", totalout);
#define DO(stat, row, col) \
mvwprintw(wnd, row, col, "%9lu", stats.stat)
DO(icps_badcode, 3, 0);
DO(icps_badlen, 4, 0);
DO(icps_checksum, 5, 0);
DO(icps_tooshort, 6, 0);
DO(icps_error, 3, 35);
DO(icps_oldshort, 4, 35);
DO(icps_oldicmp, 5, 35);
DO(icps_reflect, 6, 35);
DO(icps_bmcastecho, 7, 35);
DO(icps_bmcasttstamp, 8, 35);
DO(icps_badcode, 2, 0);
DO(icps_badlen, 3, 0);
DO(icps_checksum, 4, 0);
DO(icps_tooshort, 5, 0);
DO(icps_error, 2, 35);
DO(icps_oldshort, 3, 35);
DO(icps_oldicmp, 4, 35);
DO(icps_reflect, 5, 35);
DO(icps_bmcastecho, 6, 35);
DO(icps_bmcasttstamp, 7, 35);
#define DO2(type, row) DO(icps_inhist[type], row, 0); DO(icps_outhist[type], \
row, 35)
DO2(ICMP_ECHOREPLY, 11);
DO2(ICMP_ECHO, 12);
DO2(ICMP_UNREACH, 13);
DO2(ICMP_REDIRECT, 14);
DO2(ICMP_TIMXCEED, 15);
DO2(ICMP_PARAMPROB, 16);
DO(icps_inhist[ICMP_ROUTERADVERT], 17, 0);
DO(icps_outhist[ICMP_ROUTERSOLICIT], 17, 35);
DO2(ICMP_ECHOREPLY, 10);
DO2(ICMP_ECHO, 11);
DO2(ICMP_UNREACH, 12);
DO2(ICMP_REDIRECT, 13);
DO2(ICMP_TIMXCEED, 14);
DO2(ICMP_PARAMPROB, 15);
DO(icps_inhist[ICMP_ROUTERADVERT], 16, 0);
DO(icps_outhist[ICMP_ROUTERSOLICIT], 16, 35);
#undef DO
#undef DO2
}

View File

@ -64,25 +64,25 @@ static struct icmp6stat icmp6stat, initstat, oldstat;
/*-
--0 1 2 3 4 5 6 7
--0123456789012345678901234567890123456789012345678901234567890123456789012345
01 ICMPv6 Input ICMPv6 Output
02999999999 total messages 999999999 total messages
03999999999 with bad code 999999999 errors generated
04999999999 with bad length 999999999 suppressed - original too short
05999999999 with bad checksum 999999999 suppressed - original was ICMP
06999999999 with insufficient data 999999999 responses sent
07
08 Input Histogram Output Histogram
09999999999 echo response 999999999 echo response
10999999999 echo request 999999999 echo request
11999999999 destination unreachable 999999999 destination unreachable
12999999999 redirect 999999999 redirect
13999999999 time-to-live exceeded 999999999 time-to-line exceeded
14999999999 parameter problem 999999999 parameter problem
15999999999 neighbor solicitation 999999999 neighbor solicitation
16999999999 neighbor advertisment 999999999 neighbor advertisment
17999999999 router advertisement 999999999 router solicitation
00 ICMPv6 Input ICMPv6 Output
01999999999 total messages 999999999 total messages
02999999999 with bad code 999999999 errors generated
03999999999 with bad length 999999999 suppressed - original too short
04999999999 with bad checksum 999999999 suppressed - original was ICMP
05999999999 with insufficient data 999999999 responses sent
06
07 Input Histogram Output Histogram
08999999999 echo response 999999999 echo response
09999999999 echo request 999999999 echo request
10999999999 destination unreachable 999999999 destination unreachable
11999999999 redirect 999999999 redirect
12999999999 time-to-live exceeded 999999999 time-to-line exceeded
13999999999 parameter problem 999999999 parameter problem
14999999999 neighbor solicitation 999999999 neighbor solicitation
15999999999 neighbor advertisment 999999999 neighbor advertisment
16999999999 router advertisement 999999999 router solicitation
17
18
19
--0123456789012345678901234567890123456789012345678901234567890123456789012345
--0 1 2 3 4 5 6 7
*/
@ -90,7 +90,7 @@ static struct icmp6stat icmp6stat, initstat, oldstat;
WINDOW *
openicmp6(void)
{
return (subwin(stdscr, LINES-5-1, 0, 5, 0));
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void
@ -110,24 +110,24 @@ labelicmp6(void)
wmove(wnd, 0, 0); wclrtoeol(wnd);
#define L(row, str) mvwprintw(wnd, row, 10, str)
#define R(row, str) mvwprintw(wnd, row, 45, str);
L(1, "ICMPv6 Input"); R(1, "ICMPv6 Output");
L(2, "total messages"); R(2, "total messages");
L(3, "with bad code"); R(3, "errors generated");
L(4, "with bad length"); R(4, "suppressed - original too short");
L(5, "with bad checksum"); R(5, "suppressed - original was ICMP");
L(6, "with insufficient data"); R(6, "responses sent");
L(0, "ICMPv6 Input"); R(0, "ICMPv6 Output");
L(1, "total messages"); R(1, "total messages");
L(2, "with bad code"); R(2, "errors generated");
L(3, "with bad length"); R(3, "suppressed - original too short");
L(4, "with bad checksum"); R(4, "suppressed - original was ICMP");
L(5, "with insufficient data"); R(5, "responses sent");
L(8, "Input Histogram"); R(8, "Output Histogram");
L(7, "Input Histogram"); R(7, "Output Histogram");
#define B(row, str) L(row, str); R(row, str)
B(9, "echo response");
B(10, "echo request");
B(11, "destination unreachable");
B(12, "redirect");
B(13, "time-to-live exceeded");
B(14, "parameter problem");
B(15, "neighbor solicitation");
B(16, "neighbor advertisment");
L(17, "router advertisement"); R(17, "router solicitation");
B(8, "echo response");
B(9, "echo request");
B(10, "destination unreachable");
B(11, "redirect");
B(12, "time-to-live exceeded");
B(13, "parameter problem");
B(14, "neighbor solicitation");
B(15, "neighbor advertisment");
L(16, "router advertisement"); R(16, "router solicitation");
#undef L
#undef R
#undef B
@ -187,32 +187,32 @@ showicmp6(void)
}
totalin += stats.icp6s_badcode + stats.icp6s_badlen +
stats.icp6s_checksum + stats.icp6s_tooshort;
mvwprintw(wnd, 2, 0, "%9lu", totalin);
mvwprintw(wnd, 2, 35, "%9lu", totalout);
mvwprintw(wnd, 1, 0, "%9lu", totalin);
mvwprintw(wnd, 1, 35, "%9lu", totalout);
#define DO(stat, row, col) \
mvwprintw(wnd, row, col, "%9lu", stats.stat)
DO(icp6s_badcode, 3, 0);
DO(icp6s_badlen, 4, 0);
DO(icp6s_checksum, 5, 0);
DO(icp6s_tooshort, 6, 0);
DO(icp6s_error, 3, 35);
DO(icp6s_tooshort, 4, 35);
DO(icp6s_canterror, 5, 35);
DO(icp6s_reflect, 6, 35);
DO(icp6s_badcode, 2, 0);
DO(icp6s_badlen, 3, 0);
DO(icp6s_checksum, 4, 0);
DO(icp6s_tooshort, 5, 0);
DO(icp6s_error, 2, 35);
DO(icp6s_tooshort, 3, 35);
DO(icp6s_canterror, 4, 35);
DO(icp6s_reflect, 5, 35);
#define DO2(type, row) DO(icp6s_inhist[type], row, 0); DO(icp6s_outhist[type], \
row, 35)
DO2(ICMP6_ECHO_REPLY, 9);
DO2(ICMP6_ECHO_REQUEST, 10);
DO2(ICMP6_DST_UNREACH, 11);
DO2(ND_REDIRECT, 12);
DO2(ICMP6_TIME_EXCEEDED, 13);
DO2(ICMP6_PARAM_PROB, 14);
DO2(ND_NEIGHBOR_SOLICIT, 15);
DO2(ND_NEIGHBOR_ADVERT, 16);
DO(icp6s_inhist[ND_ROUTER_SOLICIT], 17, 0);
DO(icp6s_outhist[ND_ROUTER_ADVERT], 17, 35);
DO2(ICMP6_ECHO_REPLY, 8);
DO2(ICMP6_ECHO_REQUEST, 9);
DO2(ICMP6_DST_UNREACH, 10);
DO2(ND_REDIRECT, 11);
DO2(ICMP6_TIME_EXCEEDED, 12);
DO2(ICMP6_PARAM_PROB, 13);
DO2(ND_NEIGHBOR_SOLICIT, 14);
DO2(ND_NEIGHBOR_ADVERT, 15);
DO(icp6s_inhist[ND_ROUTER_SOLICIT], 16, 0);
DO(icp6s_outhist[ND_ROUTER_ADVERT], 16, 35);
#undef DO
#undef DO2
}

View File

@ -96,13 +96,13 @@ static u_int getifnum(void);
err((n), (s)); \
} while (0)
#define STARTING_ROW (8)
#define ROW_SPACING (3)
#define TOPLINE 5
#define TOPLINE 3
#define TOPLABEL \
" Interface Traffic Peak Total"
#define STARTING_ROW (TOPLINE + 1)
#define ROW_SPACING (3)
#define CLEAR_LINE(y, x) do { \
wmove(wnd, y, x); \
wclrtoeol(wnd); \
@ -153,7 +153,7 @@ static u_int getifnum(void);
WINDOW *
openifstat(void)
{
return (subwin(stdscr, LINES-1-5, 0, 5, 0));
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void

View File

@ -97,7 +97,7 @@ static void stat1(int, int);
WINDOW *
openiostat()
{
return (subwin(stdscr, LINES-1-5, 0, 5, 0));
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void

View File

@ -73,25 +73,25 @@ static struct stat curstat, initstat, oldstat;
/*-
--0 1 2 3 4 5 6 7
--0123456789012345678901234567890123456789012345678901234567890123456789012345
01 IP Input IP Output
02999999999 total packets received 999999999 total packets sent
03999999999 - with bad checksums 999999999 - generated locally
04999999999 - too short for header 999999999 - output drops
05999999999 - too short for data 999999999 output fragments generated
06999999999 - with invalid hlen 999999999 - fragmentation failed
07999999999 - with invalid length 999999999 destinations unreachable
08999999999 - with invalid version 999999999 packets output via raw IP
09999999999 - jumbograms
10999999999 total fragments received UDP Statistics
11999999999 - fragments dropped 999999999 total input packets
12999999999 - fragments timed out 999999999 - too short for header
13999999999 - packets reassembled ok 999999999 - invalid checksum
14999999999 packets forwarded 999999999 - no checksum
15999999999 - unreachable dests 999999999 - invalid length
16999999999 - redirects generated 999999999 - no socket for dest port
17999999999 option errors 999999999 - no socket for broadcast
18999999999 unwanted multicasts 999999999 - socket buffer full
19999999999 delivered to upper layer 999999999 total output packets
00 IP Input IP Output
01999999999 total packets received 999999999 total packets sent
02999999999 - with bad checksums 999999999 - generated locally
03999999999 - too short for header 999999999 - output drops
04999999999 - too short for data 999999999 output fragments generated
05999999999 - with invalid hlen 999999999 - fragmentation failed
06999999999 - with invalid length 999999999 destinations unreachable
07999999999 - with invalid version 999999999 packets output via raw IP
08999999999 - jumbograms
09999999999 total fragments received UDP Statistics
10999999999 - fragments dropped 999999999 total input packets
11999999999 - fragments timed out 999999999 - too short for header
12999999999 - packets reassembled ok 999999999 - invalid checksum
13999999999 packets forwarded 999999999 - no checksum
14999999999 - unreachable dests 999999999 - invalid length
15999999999 - redirects generated 999999999 - no socket for dest port
16999999999 option errors 999999999 - no socket for broadcast
17999999999 unwanted multicasts 999999999 - socket buffer full
18999999999 delivered to upper layer 999999999 total output packets
--0123456789012345678901234567890123456789012345678901234567890123456789012345
--0 1 2 3 4 5 6 7
*/
@ -99,7 +99,7 @@ static struct stat curstat, initstat, oldstat;
WINDOW *
openip(void)
{
return (subwin(stdscr, LINES-4-1, 0, 4, 0));
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void
@ -119,25 +119,25 @@ labelip(void)
wmove(wnd, 0, 0); wclrtoeol(wnd);
#define L(row, str) mvwprintw(wnd, row, 10, str)
#define R(row, str) mvwprintw(wnd, row, 45, str);
L(1, "IP Input"); R(1, "IP Output");
L(2, "total packets received"); R(2, "total packets sent");
L(3, "- with bad checksums"); R(3, "- generated locally");
L(4, "- too short for header"); R(4, "- output drops");
L(5, "- too short for data"); R(5, "output fragments generated");
L(6, "- with invalid hlen"); R(6, "- fragmentation failed");
L(7, "- with invalid length"); R(7, "destinations unreachable");
L(8, "- with invalid version"); R(8, "packets output via raw IP");
L(9, "- jumbograms");
L(10, "total fragments received"); R(10, "UDP Statistics");
L(11, "- fragments dropped"); R(11, "total input packets");
L(12, "- fragments timed out"); R(12, "- too short for header");
L(13, "- packets reassembled ok"); R(13, "- invalid checksum");
L(14, "packets forwarded"); R(14, "- no checksum");
L(15, "- unreachable dests"); R(15, "- invalid length");
L(16, "- redirects generated"); R(16, "- no socket for dest port");
L(17, "option errors"); R(17, "- no socket for broadcast");
L(18, "unwanted multicasts"); R(18, "- socket buffer full");
L(19, "delivered to upper layer"); R(19, "total output packets");
L(0, "IP Input"); R(0, "IP Output");
L(1, "total packets received"); R(1, "total packets sent");
L(2, "- with bad checksums"); R(2, "- generated locally");
L(3, "- too short for header"); R(3, "- output drops");
L(4, "- too short for data"); R(4, "output fragments generated");
L(5, "- with invalid hlen"); R(5, "- fragmentation failed");
L(6, "- with invalid length"); R(6, "destinations unreachable");
L(7, "- with invalid version"); R(7, "packets output via raw IP");
L(8, "- jumbograms");
L(9, "total fragments received"); R(9, "UDP Statistics");
L(10, "- fragments dropped"); R(10, "total input packets");
L(11, "- fragments timed out"); R(11, "- too short for header");
L(12, "- packets reassembled ok"); R(12, "- invalid checksum");
L(13, "packets forwarded"); R(13, "- no checksum");
L(14, "- unreachable dests"); R(14, "- invalid length");
L(15, "- redirects generated"); R(15, "- no socket for dest port");
L(16, "option errors"); R(16, "- no socket for broadcast");
L(17, "unwanted multicasts"); R(17, "- socket buffer full");
L(18, "delivered to upper layer"); R(18, "total output packets");
#undef L
#undef R
}
@ -214,40 +214,40 @@ showip(void)
#define DO(stat, row, col) \
mvwprintw(wnd, row, col, "%9lu", stats.stat)
DO(i.ips_total, 2, 0);
mvwprintw(wnd, 2, 35, "%9lu", totalout);
DO(i.ips_badsum, 3, 0);
DO(i.ips_localout, 3, 35);
DO(i.ips_tooshort, 4, 0);
DO(i.ips_odropped, 4, 35);
DO(i.ips_toosmall, 5, 0);
DO(i.ips_ofragments, 5, 35);
DO(i.ips_badhlen, 6, 0);
DO(i.ips_cantfrag, 6, 35);
DO(i.ips_badlen, 7, 0);
DO(i.ips_noroute, 7, 35);
DO(i.ips_badvers, 8, 0);
DO(i.ips_rawout, 8, 35);
DO(i.ips_toolong, 9, 0);
DO(i.ips_fragments, 10, 0);
DO(i.ips_fragdropped, 11, 0);
DO(u.udps_ipackets, 11, 35);
DO(i.ips_fragtimeout, 12, 0);
DO(u.udps_hdrops, 12, 35);
DO(i.ips_reassembled, 13, 0);
DO(u.udps_badsum, 13, 35);
DO(i.ips_forward, 14, 0);
DO(u.udps_nosum, 14, 35);
DO(i.ips_cantforward, 15, 0);
DO(u.udps_badlen, 15, 35);
DO(i.ips_redirectsent, 16, 0);
DO(u.udps_noport, 16, 35);
DO(i.ips_badoptions, 17, 0);
DO(u.udps_noportbcast, 17, 35);
DO(i.ips_notmember, 18, 0);
DO(u.udps_fullsock, 18, 35);
DO(i.ips_delivered, 19, 0);
DO(u.udps_opackets, 19, 35);
DO(i.ips_total, 1, 0);
mvwprintw(wnd, 1, 35, "%9lu", totalout);
DO(i.ips_badsum, 2, 0);
DO(i.ips_localout, 2, 35);
DO(i.ips_tooshort, 3, 0);
DO(i.ips_odropped, 3, 35);
DO(i.ips_toosmall, 4, 0);
DO(i.ips_ofragments, 4, 35);
DO(i.ips_badhlen, 5, 0);
DO(i.ips_cantfrag, 5, 35);
DO(i.ips_badlen, 6, 0);
DO(i.ips_noroute, 6, 35);
DO(i.ips_badvers, 7, 0);
DO(i.ips_rawout, 7, 35);
DO(i.ips_toolong, 8, 0);
DO(i.ips_fragments, 9, 0);
DO(i.ips_fragdropped, 10, 0);
DO(u.udps_ipackets, 10, 35);
DO(i.ips_fragtimeout, 11, 0);
DO(u.udps_hdrops, 11, 35);
DO(i.ips_reassembled, 12, 0);
DO(u.udps_badsum, 12, 35);
DO(i.ips_forward, 13, 0);
DO(u.udps_nosum, 13, 35);
DO(i.ips_cantforward, 14, 0);
DO(u.udps_badlen, 14, 35);
DO(i.ips_redirectsent, 15, 0);
DO(u.udps_noport, 15, 35);
DO(i.ips_badoptions, 16, 0);
DO(u.udps_noportbcast, 16, 35);
DO(i.ips_notmember, 17, 0);
DO(u.udps_fullsock, 17, 35);
DO(i.ips_delivered, 18, 0);
DO(u.udps_opackets, 18, 35);
#undef DO
}

View File

@ -67,25 +67,26 @@ static struct ip6stat curstat, initstat, oldstat;
/*-
--0 1 2 3 4 5 6 7
--0123456789012345678901234567890123456789012345678901234567890123456789012345
01 IPv6 Input IPv6 Output
029999999 total packets received 999999999 total packets sent
039999999 - too short for header 999999999 - generated locally
049999999 - too short for data 999999999 - output drops
059999999 - with invalid version 999999999 output fragments generated
069999999 total fragments received 999999999 - fragmentation failed
079999999 - fragments dropped 999999999 destinations unreachable
089999999 - fragments timed out 999999999 packets output via raw IP
099999999 - fragments overflown Input next-header histogram
109999999 - packets reassembled ok 999999999 - destination options
119999999 packets forwarded 999999999 - hop-by-hop options
129999999 - unreachable dests 999999999 - IPv4
139999999 - redirects generated 999999999 - TCP
149999999 option errors 999999999 - UDP
159999999 unwanted multicasts 999999999 - IPv6
169999999 delivered to upper layer 999999999 - routing header
17 999999999 - fragmentation header
189999999 bad scope packets 999999999 - ICMP6
199999999 address selection failed 999999999 - none
00 IPv6 Input IPv6 Output
019999999 total packets received 999999999 total packets sent
029999999 - too short for header 999999999 - generated locally
039999999 - too short for data 999999999 - output drops
049999999 - with invalid version 999999999 output fragments generated
059999999 total fragments received 999999999 - fragmentation failed
069999999 - fragments dropped 999999999 destinations unreachable
079999999 - fragments timed out 999999999 packets output via raw IP
089999999 - fragments overflown
099999999 - packets reassembled ok Input next-header histogram
109999999 packets forwarded 999999999 - destination options
119999999 - unreachable dests 999999999 - hop-by-hop options
129999999 - redirects generated 999999999 - IPv4
139999999 option errors 999999999 - TCP
149999999 unwanted multicasts 999999999 - UDP
159999999 delivered to upper layer 999999999 - IPv6
169999999 bad scope packets 999999999 - routing header
179999999 address selection failed 999999999 - fragmentation header
18 999999999 - ICMP6
19 999999999 - none
--0123456789012345678901234567890123456789012345678901234567890123456789012345
--0 1 2 3 4 5 6 7
*/
@ -93,7 +94,7 @@ static struct ip6stat curstat, initstat, oldstat;
WINDOW *
openip6(void)
{
return (subwin(stdscr, LINES-4-1, 0, 4, 0));
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void
@ -113,25 +114,26 @@ labelip6(void)
wmove(wnd, 0, 0); wclrtoeol(wnd);
#define L(row, str) mvwprintw(wnd, row, 10, str)
#define R(row, str) mvwprintw(wnd, row, 45, str);
L(1, "IPv6 Input"); R(1, "IPv6 Output");
L(2, "total packets received"); R(2, "total packets sent");
L(3, "- too short for header"); R(3, "- generated locally");
L(4, "- too short for data"); R(4, "- output drops");
L(5, "- with invalid version"); R(5, "output fragments generated");
L(6, "total fragments received"); R(6, "- fragmentation failed");
L(7, "- fragments dropped"); R(7, "destinations unreachable");
L(8, "- fragments timed out"); R(8, "packets output via raw IP");
L(9, "- fragments overflown"); R(9, "Input next-header histogram");
L(10, "- packets reassembled ok"); R(10, " - destination options");
L(11, "packets forwarded"); R(11, " - hop-by-hop options");
L(12, "- unreachable dests"); R(12, " - IPv4");
L(13, "- redirects generated"); R(13, " - TCP");
L(14, "option errors"); R(14, " - UDP");
L(15, "unwanted multicasts"); R(15, " - IPv6");
L(16, "delivered to upper layer"); R(16, " - routing header");
R(17, " - fragmentation header");
L(18, "bad scope packets"); R(18, " - ICMP6");
L(19, "address selection failed"); R(19, " - none");
L(0, "IPv6 Input"); R(0, "IPv6 Output");
L(1, "total packets received"); R(1, "total packets sent");
L(2, "- too short for header"); R(2, "- generated locally");
L(3, "- too short for data"); R(3, "- output drops");
L(4, "- with invalid version"); R(4, "output fragments generated");
L(5, "total fragments received"); R(5, "- fragmentation failed");
L(6, "- fragments dropped"); R(6, "destinations unreachable");
L(7, "- fragments timed out"); R(7, "packets output via raw IP");
L(8, "- fragments overflown");
L(9, "- packets reassembled ok"); R(9, "Input next-header histogram");
L(10, "packets forwarded"); R(10, " - destination options");
L(11, "- unreachable dests"); R(11, " - hop-by-hop options");
L(12, "- redirects generated"); R(12, " - IPv4");
L(13, "option errors"); R(13, " - TCP");
L(14, "unwanted multicasts"); R(14, " - UDP");
L(15, "delivered to upper layer"); R(15, " - IPv6");
L(16, "bad scope packets"); R(16, " - routing header");
L(17, "address selection failed"); R(17, " - fragmentation header");
R(18, " - ICMP6");
R(19, " - none");
#undef L
#undef R
}
@ -199,40 +201,40 @@ showip6(void)
#define DO(stat, row, col) \
mvwprintw(wnd, row, col, "%9lu", stats.stat)
DO(ip6s_total, 2, 0);
mvwprintw(wnd, 2, 35, "%9lu", totalout);
DO(ip6s_localout, 3, 35);
DO(ip6s_tooshort, 3, 0);
DO(ip6s_odropped, 4, 35);
DO(ip6s_toosmall, 4, 0);
DO(ip6s_ofragments, 5, 35);
DO(ip6s_badvers, 5, 0);
DO(ip6s_cantfrag, 6, 35);
DO(ip6s_fragments, 6, 0);
DO(ip6s_noroute, 7, 35);
DO(ip6s_fragdropped, 7, 0);
DO(ip6s_rawout, 8, 35);
DO(ip6s_fragtimeout, 8, 0);
DO(ip6s_fragoverflow, 9, 0);
DO(ip6s_total, 1, 0);
mvwprintw(wnd, 1, 35, "%9lu", totalout);
DO(ip6s_tooshort, 2, 0);
DO(ip6s_localout, 2, 35);
DO(ip6s_toosmall, 3, 0);
DO(ip6s_odropped, 3, 35);
DO(ip6s_badvers, 4, 0);
DO(ip6s_ofragments, 4, 35);
DO(ip6s_fragments, 5, 0);
DO(ip6s_cantfrag, 5, 35);
DO(ip6s_fragdropped, 6, 0);
DO(ip6s_noroute, 6, 35);
DO(ip6s_fragtimeout, 7, 0);
DO(ip6s_rawout, 7, 35);
DO(ip6s_fragoverflow, 8, 0);
DO(ip6s_reassembled, 9, 0);
DO(ip6s_forward, 10, 0);
DO(ip6s_nxthist[IPPROTO_DSTOPTS], 10, 35);
DO(ip6s_reassembled, 10, 0);
DO(ip6s_cantforward, 11, 0);
DO(ip6s_nxthist[IPPROTO_HOPOPTS], 11, 35);
DO(ip6s_forward, 11, 0);
DO(ip6s_redirectsent, 12, 0);
DO(ip6s_nxthist[IPPROTO_IPV4], 12, 35);
DO(ip6s_cantforward, 12, 0);
DO(ip6s_badoptions, 13, 0);
DO(ip6s_nxthist[IPPROTO_TCP], 13, 35);
DO(ip6s_redirectsent, 13, 0);
DO(ip6s_notmember, 14, 0);
DO(ip6s_nxthist[IPPROTO_UDP], 14, 35);
DO(ip6s_badoptions, 14, 0);
DO(ip6s_delivered, 15, 0);
DO(ip6s_nxthist[IPPROTO_IPV6], 15, 35);
DO(ip6s_notmember, 15, 0);
DO(ip6s_badscope, 16, 0);
DO(ip6s_nxthist[IPPROTO_ROUTING], 16, 35);
DO(ip6s_delivered, 16, 0);
DO(ip6s_sources_none, 17, 0);
DO(ip6s_nxthist[IPPROTO_FRAGMENT], 17, 35);
DO(ip6s_nxthist[IPPROTO_ICMPV6], 18, 35);
DO(ip6s_badscope, 18, 0);
DO(ip6s_nxthist[IPPROTO_NONE], 19, 35);
DO(ip6s_sources_none, 19, 0);
#undef DO
}

View File

@ -150,7 +150,7 @@ main(int argc, char **argv)
warnx("couldn't initialize display");
die(0);
}
wload = newwin(1, 0, 3, 20);
wload = newwin(1, 0, 1, 20);
if (wload == NULL) {
warnx("couldn't set up load average window");
die(0);
@ -183,9 +183,9 @@ void
labels()
{
if (curcmd->c_flags & CF_LOADAV) {
mvaddstr(2, 20,
mvaddstr(0, 20,
"/0 /1 /2 /3 /4 /5 /6 /7 /8 /9 /10");
mvaddstr(3, 5, "Load Average");
mvaddstr(1, 5, "Load Average");
}
(*curcmd->c_label)();
#ifdef notdef

View File

@ -72,7 +72,7 @@ static struct mtnames {
WINDOW *
openmbufs()
{
return (subwin(stdscr, LINES-5-1, 0, 5, 0));
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void

View File

@ -97,7 +97,7 @@ opennetstat()
{
sethostent(1);
setnetent(1);
return (subwin(stdscr, LINES-5-1, 0, 5, 0));
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
struct netinfo {

View File

@ -73,7 +73,7 @@ static double lccpu;
WINDOW *
openpigs()
{
return (subwin(stdscr, LINES-5-1, 0, 5, 0));
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void

View File

@ -66,7 +66,7 @@ static int hlen;
WINDOW *
openswap()
{
return (subwin(stdscr, LINES-5-1, 0, 5, 0));
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void

View File

@ -62,6 +62,8 @@ extern int use_kvm;
#define TCP 0x1
#define UDP 0x2
#define MAINWIN_ROW 3 /* top row for the main/lower window */
#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))
#define KREAD(addr, buf, len) kvm_ckread((addr), (buf), (len))
#define NVAL(indx) namelist[(indx)].n_value

View File

@ -70,26 +70,26 @@ static struct tcpstat curstat, initstat, oldstat;
/*-
--0 1 2 3 4 5 6 7
--0123456789012345678901234567890123456789012345678901234567890123456789012345
01 TCP Connections TCP Packets
02999999999 connections initiated 999999999 total packets sent
03999999999 connections accepted 999999999 - data
04999999999 connections established 999999999 - data (retransmit)
05999999999 connections dropped 999999999 - ack-only
06999999999 - in embryonic state 999999999 - window probes
07999999999 - on retransmit timeout 999999999 - window updates
08999999999 - by keepalive 999999999 - urgent data only
09999999999 - from listen queue 999999999 - control
10 999999999 - resends by PMTU discovery
11 TCP Timers 999999999 total packets received
12999999999 potential rtt updates 999999999 - in sequence
13999999999 - successful 999999999 - completely duplicate
14999999999 delayed acks sent 999999999 - with some duplicate data
15999999999 retransmit timeouts 999999999 - out-of-order
16999999999 persist timeouts 999999999 - duplicate acks
17999999999 keepalive probes 999999999 - acks
18999999999 - timeouts 999999999 - window probes
19 999999999 - window updates
20 999999999 - bad checksum
00 TCP Connections TCP Packets
01999999999 connections initiated 999999999 total packets sent
02999999999 connections accepted 999999999 - data
03999999999 connections established 999999999 - data (retransmit)
04999999999 connections dropped 999999999 - ack-only
05999999999 - in embryonic state 999999999 - window probes
06999999999 - on retransmit timeout 999999999 - window updates
07999999999 - by keepalive 999999999 - urgent data only
08999999999 - from listen queue 999999999 - control
09 999999999 - resends by PMTU discovery
10 TCP Timers 999999999 total packets received
11999999999 potential rtt updates 999999999 - in sequence
12999999999 - successful 999999999 - completely duplicate
13999999999 delayed acks sent 999999999 - with some duplicate data
14999999999 retransmit timeouts 999999999 - out-of-order
15999999999 persist timeouts 999999999 - duplicate acks
16999999999 keepalive probes 999999999 - acks
17999999999 - timeouts 999999999 - window probes
18 999999999 - window updates
19 999999999 - bad checksum
--0123456789012345678901234567890123456789012345678901234567890123456789012345
--0 1 2 3 4 5 6 7
*/
@ -97,8 +97,7 @@ static struct tcpstat curstat, initstat, oldstat;
WINDOW *
opentcp(void)
{
return (stdscr);
return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
}
void
@ -109,6 +108,7 @@ closetcp(w)
return;
wclear(w);
wrefresh(w);
delwin(w);
}
void
@ -117,26 +117,26 @@ labeltcp(void)
wmove(wnd, 0, 0); wclrtoeol(wnd);
#define L(row, str) mvwprintw(wnd, row, 10, str)
#define R(row, str) mvwprintw(wnd, row, 45, str);
L(1, "TCP Connections"); R(1, "TCP Packets");
L(2, "connections initiated"); R(2, "total packets sent");
L(3, "connections accepted"); R(3, "- data");
L(4, "connections established"); R(4, "- data (retransmit)");
L(5, "connections dropped"); R(5, "- ack-only");
L(6, "- in embryonic state"); R(6, "- window probes");
L(7, "- on retransmit timeout"); R(7, "- window updates");
L(8, "- by keepalive"); R(8, "- urgent data only");
L(9, "- from listen queue"); R(9, "- control");
R(10, "- resends by PMTU discovery");
L(11, "TCP Timers"); R(11, "total packets received");
L(12, "potential rtt updates"); R(12, "- in sequence");
L(13, "- successful"); R(13, "- completely duplicate");
L(14, "delayed acks sent"); R(14, "- with some duplicate data");
L(15, "retransmit timeouts"); R(15, "- out-of-order");
L(16, "persist timeouts"); R(16, "- duplicate acks");
L(17, "keepalive probes"); R(17, "- acks");
L(18, "- timeouts"); R(18, "- window probes");
R(19, "- window updates");
R(20, "- bad checksum");
L(0, "TCP Connections"); R(0, "TCP Packets");
L(1, "connections initiated"); R(1, "total packets sent");
L(2, "connections accepted"); R(2, "- data");
L(3, "connections established"); R(3, "- data (retransmit)");
L(4, "connections dropped"); R(4, "- ack-only");
L(5, "- in embryonic state"); R(5, "- window probes");
L(6, "- on retransmit timeout"); R(6, "- window updates");
L(7, "- by keepalive"); R(7, "- urgent data only");
L(8, "- from listen queue"); R(8, "- control");
R(9, "- resends by PMTU discovery");
L(10, "TCP Timers"); R(10, "total packets received");
L(11, "potential rtt updates"); R(11, "- in sequence");
L(12, "- successful"); R(12, "- completely duplicate");
L(13, "delayed acks sent"); R(13, "- with some duplicate data");
L(14, "retransmit timeouts"); R(14, "- out-of-order");
L(15, "persist timeouts"); R(15, "- duplicate acks");
L(16, "keepalive probes"); R(16, "- acks");
L(17, "- timeouts"); R(17, "- window probes");
R(18, "- window updates");
R(19, "- bad checksum");
#undef L
#undef R
}
@ -240,25 +240,25 @@ showtcp(void)
mvwprintw(wnd, row, col, "%9lu", stats.stat)
#define L(row, stat) DO(stat, row, 0)
#define R(row, stat) DO(stat, row, 35)
L(2, tcps_connattempt); R(2, tcps_sndtotal);
L(3, tcps_accepts); R(3, tcps_sndpack);
L(4, tcps_connects); R(4, tcps_sndrexmitpack);
L(5, tcps_drops); R(5, tcps_sndacks);
L(6, tcps_conndrops); R(6, tcps_sndprobe);
L(7, tcps_timeoutdrop); R(7, tcps_sndwinup);
L(8, tcps_keepdrops); R(8, tcps_sndurg);
L(9, tcps_listendrop); R(9, tcps_sndctrl);
R(10, tcps_mturesent);
R(11, tcps_rcvtotal);
L(12, tcps_segstimed); R(12, tcps_rcvpack);
L(13, tcps_rttupdated); R(13, tcps_rcvduppack);
L(14, tcps_delack); R(14, tcps_rcvpartduppack);
L(15, tcps_rexmttimeo); R(15, tcps_rcvoopack);
L(16, tcps_persisttimeo); R(16, tcps_rcvdupack);
L(17, tcps_keepprobe); R(17, tcps_rcvackpack);
L(18, tcps_keeptimeo); R(18, tcps_rcvwinprobe);
R(19, tcps_rcvwinupd);
R(20, tcps_rcvbadsum);
L(1, tcps_connattempt); R(1, tcps_sndtotal);
L(2, tcps_accepts); R(2, tcps_sndpack);
L(3, tcps_connects); R(3, tcps_sndrexmitpack);
L(4, tcps_drops); R(4, tcps_sndacks);
L(5, tcps_conndrops); R(5, tcps_sndprobe);
L(6, tcps_timeoutdrop); R(6, tcps_sndwinup);
L(7, tcps_keepdrops); R(7, tcps_sndurg);
L(8, tcps_listendrop); R(8, tcps_sndctrl);
R(9, tcps_mturesent);
R(10, tcps_rcvtotal);
L(11, tcps_segstimed); R(11, tcps_rcvpack);
L(12, tcps_rttupdated); R(12, tcps_rcvduppack);
L(13, tcps_delack); R(13, tcps_rcvpartduppack);
L(14, tcps_rexmttimeo); R(14, tcps_rcvoopack);
L(15, tcps_persisttimeo); R(15, tcps_rcvdupack);
L(16, tcps_keepprobe); R(16, tcps_rcvackpack);
L(17, tcps_keeptimeo); R(17, tcps_rcvwinprobe);
R(18, tcps_rcvwinupd);
R(19, tcps_rcvbadsum);
#undef DO
#undef L
#undef R