On Thu, Nov 15, 2018 at 11:32:23AM +1000, David Gwynne wrote: > On Fri, Nov 17, 2017 at 01:11:52PM -0000, Christian Weisgerber wrote: > > On 2017-11-17, David Gwynne <da...@gwynne.id.au> wrote: > > > > > can we have modified displays within a view? > > > > We already have this for the ifstat view. > > > > The character B changes the counter view between bytes and > > bits. Pressing b displays statistics as calculated from boot > > time. r changes the counters to show their totals as > > calculated between display refreshes. t changes the counters > > to show the average per second over the display refresh > > interval; this is the default. > > So how about 'd' to show drops, and 'e' to show errors again? Or should > I make a toggle like 'B' to switch between them?
As mentioned to you I think it is useful to see the drop counters. I would not mind to have systat show the sum of all drops (ierrs + iqdrops) for example. Having netstat -i show all counters would good. The idea is you can use systat to see that packets are lost and netstat to see why exactly they are lost. I doubt people switch modes in systat (at least I never remember all the magic key combos). > Index: engine.h > =================================================================== > RCS file: /cvs/src/usr.bin/systat/engine.h,v > retrieving revision 1.9 > diff -u -p -r1.9 engine.h > --- engine.h 8 Feb 2018 07:00:33 -0000 1.9 > +++ engine.h 15 Nov 2018 01:30:41 -0000 > @@ -53,7 +53,7 @@ > > > typedef struct { > - char *title; > + const char *title; > int norm_width; > int max_width; > int increment; > Index: if.c > =================================================================== > RCS file: /cvs/src/usr.bin/systat/if.c,v > retrieving revision 1.23 > diff -u -p -r1.23 if.c > --- if.c 16 Jan 2015 00:03:37 -0000 1.23 > +++ if.c 15 Nov 2018 01:30:42 -0000 > @@ -56,6 +56,12 @@ static void showifstat(struct ifstat *); > static void showtotal(void); > static void rt_getaddrinfo(struct sockaddr *, int, struct sockaddr **); > > +static const char ierrs[] = "IERRS"; > +static const char oerrs[] = "OERRS"; > +static const char iqdrops[] = "IQDROPS"; > +static const char oqdrops[] = "OQDROPS"; > + > +static int show_errs = 1; > > /* Define fields */ > field_def fields_if[] = { > @@ -63,10 +69,10 @@ field_def fields_if[] = { > {"STATE", 4, 6, 1, FLD_ALIGN_LEFT, -1, 0, 0, 0}, > {"IPKTS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > {"IBYTES", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > - {"IERRS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > + {ierrs, 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > {"OPKTS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > {"OBYTES", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > - {"OERRS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > + {oerrs, 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > {"COLLS", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0}, > {"DESC", 14, 64, 1, FLD_ALIGN_LEFT, -1, 0, 0, 0}, > }; > @@ -264,9 +270,11 @@ fetchifstat(void) > UPDATE(ifc_ip, ifm_data.ifi_ipackets); > UPDATE(ifc_ib, ifm_data.ifi_ibytes); > UPDATE(ifc_ie, ifm_data.ifi_ierrors); > + UPDATE(ifc_iq, ifm_data.ifi_iqdrops); > UPDATE(ifc_op, ifm_data.ifi_opackets); > UPDATE(ifc_ob, ifm_data.ifi_obytes); > UPDATE(ifc_oe, ifm_data.ifi_oerrors); > + UPDATE(ifc_oq, ifm_data.ifi_oqdrops); > UPDATE(ifc_co, ifm_data.ifi_collisions); > ifs->ifs_cur.ifc_flags = ifm.ifm_flags; > ifs->ifs_cur.ifc_state = ifm.ifm_data.ifi_link_state; > @@ -315,11 +323,13 @@ showifstat(struct ifstat *ifs) > > print_fld_sdiv(FLD_IF_IBYTES, ifs->ifs_cur.ifc_ib * conv, div); > print_fld_size(FLD_IF_IPKTS, ifs->ifs_cur.ifc_ip); > - print_fld_size(FLD_IF_IERRS, ifs->ifs_cur.ifc_ie); > + print_fld_size(FLD_IF_IERRS, show_errs ? > + ifs->ifs_cur.ifc_ie : ifs->ifs_cur.ifc_iq); > > print_fld_sdiv(FLD_IF_OBYTES, ifs->ifs_cur.ifc_ob * conv, div); > print_fld_size(FLD_IF_OPKTS, ifs->ifs_cur.ifc_op); > - print_fld_size(FLD_IF_OERRS, ifs->ifs_cur.ifc_oe); > + print_fld_size(FLD_IF_OERRS, show_errs ? > + ifs->ifs_cur.ifc_oe : ifs->ifs_cur.ifc_oq); > > print_fld_size(FLD_IF_COLLS, ifs->ifs_cur.ifc_co); > > @@ -336,11 +346,11 @@ showtotal(void) > > print_fld_sdiv(FLD_IF_IBYTES, sum.ifc_ib * conv, div); > print_fld_size(FLD_IF_IPKTS, sum.ifc_ip); > - print_fld_size(FLD_IF_IERRS, sum.ifc_ie); > + print_fld_size(FLD_IF_IERRS, show_errs ? sum.ifc_ie : sum.ifc_iq); > > print_fld_sdiv(FLD_IF_OBYTES, sum.ifc_ob * conv, div); > print_fld_size(FLD_IF_OPKTS, sum.ifc_op); > - print_fld_size(FLD_IF_OERRS, sum.ifc_oe); > + print_fld_size(FLD_IF_OERRS, show_errs ? sum.ifc_oe : sum.ifc_oq); > > print_fld_size(FLD_IF_COLLS, sum.ifc_co); > > @@ -354,6 +364,19 @@ if_keyboard_callback(int ch) > struct ifstat *ifs; > > switch (ch) { > + case 'd': > + show_errs = 1; > + FLD_IF_IERRS->title = iqdrops; > + FLD_IF_OERRS->title = oqdrops; > + gotsig_alarm = 1; > + break; > + case 'e': > + show_errs = 0; > + FLD_IF_IERRS->title = ierrs; > + FLD_IF_OERRS->title = oerrs; > + gotsig_alarm = 1; > + break; > + > case 'r': > for (ifs = ifstats; ifs < ifstats + nifs; ifs++) > ifs->ifs_old = ifs->ifs_now; > Index: systat.1 > =================================================================== > RCS file: /cvs/src/usr.bin/systat/systat.1,v > retrieving revision 1.110 > diff -u -p -r1.110 systat.1 > --- systat.1 25 Jul 2018 17:24:14 -0000 1.110 > +++ systat.1 15 Nov 2018 01:30:42 -0000 > @@ -290,6 +290,10 @@ between display refreshes. > changes the counters to show the average per second over > the display refresh interval; > this is the default. > +.Ic d > +displays input and output queue drops instead of errors. > +.Ic e > +displays input and output errors instead of queue drops. > .It Ic iostat > Display statistics about disk throughput. > Statistics > Index: systat.h > =================================================================== > RCS file: /cvs/src/usr.bin/systat/systat.h,v > retrieving revision 1.22 > diff -u -p -r1.22 systat.h > --- systat.h 30 May 2018 13:43:51 -0000 1.22 > +++ systat.h 15 Nov 2018 01:30:42 -0000 > @@ -104,9 +104,11 @@ struct ifcount { > u_int64_t ifc_ib; /* input bytes */ > u_int64_t ifc_ip; /* input packets */ > u_int64_t ifc_ie; /* input errors */ > + u_int64_t ifc_iq; /* input qdrops */ > u_int64_t ifc_ob; /* output bytes */ > u_int64_t ifc_op; /* output packets */ > u_int64_t ifc_oe; /* output errors */ > + u_int64_t ifc_oq; /* output qdrops */ > u_int64_t ifc_co; /* collisions */ > int ifc_flags; /* up / down */ > int ifc_state; /* link state */ > > > -- :wq Claudio