On Wednesday, October 17, 2012 11:04:47 am Nikolay Denev wrote:
> On Jun 27, 2012, at 9:08 PM, John Baldwin <j...@freebsd.org> wrote:
> 
> > Author: jhb
> > Date: Wed Jun 27 18:08:48 2012
> > New Revision: 237656
> > URL: http://svn.freebsd.org/changeset/base/237656
> > 
> > Log:
> >  Add a new line to top that provides a brief summary of the ZFS ARC memory
> >  usage on hosts using ZFS.  The new line displays the total amount of RAM
> >  used by the ARC along with the size of MFU, MRU, anonymous (in flight),
> >  headers, and other (miscellaneous) sub-categories.  The line is not
> >  displayed on systems that are not using ZFS.
> > 
> >  Reviewed by:       avg, fs@
> >  MFC after: 3 days
> > 
> > Modified:
> >  head/contrib/top/display.c
> >  head/contrib/top/layout.h
> >  head/contrib/top/machine.h
> >  head/contrib/top/top.c
> >  head/usr.bin/top/machine.c
> >  head/usr.bin/top/top.local.1
> > 
> > 
> > Modified: head/usr.bin/top/machine.c
> > 
==============================================================================
> > --- head/usr.bin/top/machine.c      Wed Jun 27 17:51:09 2012        
> > (r237655)
> > +++ head/usr.bin/top/machine.c      Wed Jun 27 18:08:48 2012        
> > (r237656)
> > @@ -176,6 +176,12 @@ char *memorynames[] = {
> >     "K Free", NULL
> > };
> > 
> > +int arc_stats[7];
> > +char *arcnames[] = {
> > +   "K Total, ", "K MRU, ", "K MFU, ", "K Anon, ", "K Header, ", "K 
Other",
> > +   NULL
> > +};
> > +
> > 
> > +   if (arc_enabled) {
> > +           GETSYSCTL("kstat.zfs.misc.arcstats.size", arc_stat);
> > +           arc_stats[0] = arc_stat >> 10;
> > +           GETSYSCTL("vfs.zfs.mfu_size", arc_stat);
> > +           arc_stats[1] = arc_stat >> 10;
> > +           GETSYSCTL("vfs.zfs.mru_size", arc_stat);
> > +           arc_stats[2] = arc_stat >> 10;
> > +           GETSYSCTL("vfs.zfs.anon_size", arc_stat);
> > +           arc_stats[3] = arc_stat >> 10;
> > +           GETSYSCTL("kstat.zfs.misc.arcstats.hdr_size", arc_stat);
> > +           GETSYSCTL("kstat.zfs.misc.arcstats.l2_hdr_size", arc_stat2);
> > +           arc_stats[4] = arc_stat + arc_stat2 >> 10;
> > +           GETSYSCTL("kstat.zfs.misc.arcstats.other_size", arc_stat);
> > +           arc_stats[5] = arc_stat >> 10;
> > +           si->arc = arc_stats;
> > +   }
> > +               
> 
> 
> Hi,
> 
> It looks like MFU and MRU are swapped in top's display.
> 
> I'm using this to correct the output:
> 
> --- /usr/src/.zfs/snapshot/patches/usr.bin/top/machine.c        2012-09-26 
08:20:26.000000000 +0200
> +++ usr.bin/top/machine.c       2012-10-17 17:00:14.988895167 +0200
> @@ -515,9 +515,9 @@
>         if (arc_enabled) {
>                 GETSYSCTL("kstat.zfs.misc.arcstats.size", arc_stat);
>                 arc_stats[0] = arc_stat >> 10;
> -               GETSYSCTL("vfs.zfs.mfu_size", arc_stat);
> -               arc_stats[1] = arc_stat >> 10;
>                 GETSYSCTL("vfs.zfs.mru_size", arc_stat);
> +               arc_stats[1] = arc_stat >> 10;
> +               GETSYSCTL("vfs.zfs.mfu_size", arc_stat);
>                 arc_stats[2] = arc_stat >> 10;
>                 GETSYSCTL("vfs.zfs.anon_size", arc_stat);
>                 arc_stats[3] = arc_stat >> 10;

Doh!  Good catch!  I think I'd rather swap the display order so MFU is listed
before MRU (alphabetical order).

-- 
John Baldwin
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to