Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Aug 1996 08:16:51 -0700 (PDT)
From:      Matthew Dillon <dillon@backplane.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/1502: vmstat 'avm' field merges with procs 'w' field for large avm
Message-ID:  <199608171516.IAA00706@apollo.backplane.com>
Resent-Message-ID: <199608171520.IAA00343@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1502
>Category:       bin
>Synopsis:       vmstat 'avm' field merges with procs 'w' field for large avm
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 17 08:20:01 PDT 1996
>Last-Modified:
>Originator:     Matthew Dillon
>Organization:
BEST Internet Communications
>Release:        FreeBSD 2.1-STABLE i386
>Environment:

	running 2.1.5 patched to (ctm) src-2.1.0.0154.gz
	Pentium 90 
	32 MB ram

>Description:

    Here is some typical vmstat output:

 apollo:/home/dillon> vmstat 5
  procs   memory     page                    disks      faults      cpu
  r b w   avm   fre  flt  re  pi  po  fr  sr s0 s1 f0   in   sy  cs us sy id
  0 0 0132236  7780  604   0  11   0 461   0 26  9  0  302 1090 101 14 18 68
  0 0 0127968  7780    3   0   0   0   2   0  0  0  0  301  124  25  0  1 99
      ^^
    note this .. the '0' from the proc-wait field is merged with the
    '127968' from the avm field.  

    Note the fact that the avm value merges with the number of waiting 
    processes.  This makes it difficult to be able to 'glance' at a
    running vmstat.

>How-To-Repeat:

>Fix:

    I suggest either adding a space in front of the avm field, or changing
    the field to report megabytes (i.e. 45.5) rather then kilobytes.  Just
    about every system you run vmstat on overflows the current field.

    It would also be nice if vmstat had a switch to replace the avm field
    with the active-real-memory (arm) field.

    I submit below sample output that makes two changes to vmstat. 

    (1) vmstat reports avm/arm and fre in megabytes and

    (2) I added the -r option to make it report active real memory rather
  	then active virtual memory.  Active real memory is a more useful
	indicator.

apollo:/src/apollo/usr.bin/vmstat# vmstat -r 5
 procs   memory     page                    disks      faults      cpu
 r b w   arm   fre  flt  re  pi  po  fr  sr s0 s1 f0   in   sy  cs us sy id
 0 0 0   5.5   4.4   40   0   0   0  32   1  2  0  0  303  172  37  2  2 96
 0 0 0   5.2   4.4    1   0   0   0   0   0  0  0  0  298   41   7  0  1 99
 0 0 0   6.7   4.4    1   0   0   1   0   0  9  4  0  307  335  55  2  2 95


*** /usr/src/usr.bin/vmstat/vmstat.c	Sat Aug 17 06:55:20 1996
--- vmstat.c	Sat Aug 17 08:09:23 1996
***************
*** 167,172 ****
--- 167,175 ----
  void	dotimes(), doforkst();
  #endif
  
+ int ReportARM;
+ const char *AxmName = "avm";
+ 
  main(argc, argv)
  	register int argc;
  	register char **argv;
***************
*** 181,188 ****
  
  	memf = nlistf = NULL;
  	interval = reps = todo = 0;
! 	while ((c = getopt(argc, argv, "c:fiM:mN:stw:")) != EOF) {
  		switch (c) {
  		case 'c':
  			reps = atoi(optarg);
  			break;
--- 184,195 ----
  
  	memf = nlistf = NULL;
  	interval = reps = todo = 0;
! 	while ((c = getopt(argc, argv, "c:rfiM:mN:stw:")) != EOF) {
  		switch (c) {
+ 		case 'r':
+ 			ReportARM = 1;
+ 			AxmName = "arm";
+ 			break;
  		case 'c':
  			reps = atoi(optarg);
  			break;
***************
*** 423,430 ****
  		    total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw);
  #define pgtok(a) ((a) * sum.v_page_size >> 10)
  #define	rate(x)	(((x) + halfuptime) / uptime)	/* round */
! 		(void)printf("%6ld%6ld ",
! 		    pgtok(total.t_avm), pgtok(total.t_free));
  		(void)printf("%4lu ", rate(sum.v_vm_faults - osum.v_vm_faults));
  		(void)printf("%3lu ",
  		    rate(sum.v_reactivated - osum.v_reactivated));
--- 430,448 ----
  		    total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw);
  #define pgtok(a) ((a) * sum.v_page_size >> 10)
  #define	rate(x)	(((x) + halfuptime) / uptime)	/* round */
! 		{
! 		    int tf = sum.v_page_size / 1024 * total.t_free * 10 / 1024;
! 		    int arm = sum.v_page_size / 1024 * total.t_arm * 10 / 1024;
! 		    int avm = sum.v_page_size / 1024 * total.t_avm * 10 / 1024;
! 		    int axm = (ReportARM) ? arm : avm;
! 
! 		    (void)printf(" %3d.%d %3d.%d ",
! 			axm / 10,
! 			axm % 10,
! 			tf / 10,
! 			tf % 10
! 		    );
! 		}
  		(void)printf("%4lu ", rate(sum.v_vm_faults - osum.v_vm_faults));
  		(void)printf("%3lu ",
  		    rate(sum.v_reactivated - osum.v_reactivated));
***************
*** 468,474 ****
  		   ndrives * 3 - 6, "");
  	else
  		(void)printf("%*s  faults      cpu\n", ndrives * 3, "");
! 	(void)printf(" r b w   avm   fre  flt  re  pi  po  fr  sr ");
  	for (i = 0; i < dk_ndrive; i++)
  		if (dr_select[i])
  			(void)printf("%c%c ", dr_name[i][0],
--- 486,492 ----
  		   ndrives * 3 - 6, "");
  	else
  		(void)printf("%*s  faults      cpu\n", ndrives * 3, "");
! 	(void)printf(" r b w   %3s   fre  flt  re  pi  po  fr  sr ", AxmName);
  	for (i = 0; i < dk_ndrive; i++)
  		if (dr_select[i])
  			(void)printf("%c%c ", dr_name[i][0],


>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608171516.IAA00706>