=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/top/machine.c,v retrieving revision 1.68 retrieving revision 1.69 diff -c -r1.68 -r1.69 *** src/usr.bin/top/machine.c 2011/04/10 03:20:59 1.68 --- src/usr.bin/top/machine.c 2011/07/12 14:57:53 1.69 *************** *** 1,4 **** ! /* $OpenBSD: machine.c,v 1.68 2011/04/10 03:20:59 guenther Exp $ */ /*- * Copyright (c) 1994 Thorsten Lockert --- 1,4 ---- ! /* $OpenBSD: machine.c,v 1.69 2011/07/12 14:57:53 tedu Exp $ */ /*- * Copyright (c) 1994 Thorsten Lockert *************** *** 41,46 **** --- 41,47 ---- #include #include #include + #include #include #include #include *************** *** 107,116 **** }; /* these are for detailing the memory statistics */ ! int memory_stats[8]; char *memorynames[] = { ! "Real: ", "K/", "K act/tot ", "Free: ", "K ", ! "Swap: ", "K/", "K used/tot", NULL }; --- 108,118 ---- }; /* these are for detailing the memory statistics */ ! int memory_stats[10]; char *memorynames[] = { ! "Real: ", "K/", "K act/tot ", "Free: ", "K ", ! "Cache: ", "K ", ! "Swap: ", "K/", "K", NULL }; *************** *** 206,213 **** --- 208,217 ---- { static int sysload_mib[] = {CTL_VM, VM_LOADAVG}; static int vmtotal_mib[] = {CTL_VM, VM_METER}; + static int bcstats_mib[] = {CTL_VFS, VFS_GENERIC, VFS_BCACHESTAT}; struct loadavg sysload; struct vmtotal vmtotal; + struct bcachestats bcstats; double *infoloadp; size_t size; int i; *************** *** 254,259 **** --- 258,268 ---- warn("sysctl failed"); bzero(&vmtotal, sizeof(vmtotal)); } + size = sizeof(bcstats); + if (sysctl(bcstats_mib, 3, &bcstats, &size, NULL, 0) < 0) { + warn("sysctl failed"); + bzero(&bcstats, sizeof(bcstats)); + } /* convert memory stats to Kbytes */ memory_stats[0] = -1; memory_stats[1] = pagetok(vmtotal.t_arm); *************** *** 261,270 **** memory_stats[3] = -1; memory_stats[4] = pagetok(vmtotal.t_free); memory_stats[5] = -1; ! if (!swapmode(&memory_stats[6], &memory_stats[7])) { ! memory_stats[6] = 0; ! memory_stats[7] = 0; } /* set arrays and strings */ --- 270,281 ---- memory_stats[3] = -1; memory_stats[4] = pagetok(vmtotal.t_free); memory_stats[5] = -1; + memory_stats[6] = pagetok(bcstats.numbufpages); + memory_stats[7] = -1; ! if (!swapmode(&memory_stats[8], &memory_stats[9])) { ! memory_stats[8] = 0; ! memory_stats[9] = 0; } /* set arrays and strings */