]> Zhao Yanbai Git Server - minix.git/commitdiff
VM: expose secondary cache size
authorDavid van Moolenbroek <david@minix3.org>
Tue, 14 Sep 2010 21:22:56 +0000 (21:22 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Tue, 14 Sep 2010 21:22:56 +0000 (21:22 +0000)
include/minix/vm.h
servers/is/dmp_vm.c
servers/vm/proto.h
servers/vm/region.c
servers/vm/utility.c

index 2a65ffa5c0dbf99ac3a2e4df1c3a0791675b6267..63bc3592596b6629fa01ddadadf08e1cee30f906 100644 (file)
@@ -45,10 +45,11 @@ _PROTOTYPE( int vm_yield_block_get_block, (u64_t yieldid, u64_t getid,
 #define VMPTYPE_SUNMAP         4
 
 struct vm_stats_info {
-  int vsi_pagesize;            /* page size */
-  int vsi_total;               /* total number of memory pages */
-  int vsi_free;                        /* number of free pages */
-  int vsi_largest;             /* largest number of consecutive free pages */
+  unsigned int vsi_pagesize;   /* page size */
+  unsigned long vsi_total;     /* total number of memory pages */
+  unsigned long vsi_free;      /* number of free pages */
+  unsigned long vsi_largest;   /* largest number of consecutive free pages */
+  unsigned long vsi_cached;    /* number of pages cached for file systems */
 };
 
 struct vm_usage_info {
index a999ed7cd07a49cc070d1ac72503d07c415e89b7..02f02ac0b3bc037c397de65467f47d69577824f6 100644 (file)
@@ -77,10 +77,11 @@ PUBLIC void vm_dmp()
                return;
        }
 
-       printf("Total %u kB, free %u kB, largest free area %u kB\n",    
+       printf("Total %u kB, free %u kB, largest free %u kB, cached %u kB\n",
                vsi.vsi_total * (vsi.vsi_pagesize / 1024),
                vsi.vsi_free * (vsi.vsi_pagesize / 1024),
-               vsi.vsi_largest * (vsi.vsi_pagesize / 1024));
+               vsi.vsi_largest * (vsi.vsi_pagesize / 1024),
+               vsi.vsi_cached * (vsi.vsi_pagesize / 1024));
        n++;
        printf("\n");
        n++;
index 48bf118767945e1ecfe0458ec7670999622d57a9..00d243f9bb2abc5ece76ae60abdd4ba4e00c855a 100644 (file)
@@ -168,6 +168,7 @@ _PROTOTYPE(int map_get_ref, (struct vmproc *vmp, vir_bytes addr, u8_t *cnt));
 
 _PROTOTYPE(void pb_unreferenced, (struct vir_region *region,
        struct phys_region *pr));
+_PROTOTYPE(void get_stats_info, (struct vm_stats_info *vsi));
 _PROTOTYPE(void get_usage_info, (struct vmproc *vmp,
        struct vm_usage_info *vui));
 _PROTOTYPE(int get_region_info, (struct vmproc *vmp,
index 3fd760fa4c7fc13c492e9cdc3a6a4b29f6743266..362f156262738aa15116ab04b6e1f5062c233be5 100644 (file)
@@ -1825,6 +1825,19 @@ PUBLIC int map_get_ref(struct vmproc *vmp, vir_bytes addr, u8_t *cnt)
        return OK;
 }
 
+/*========================================================================*
+ *                             get_stats_info                            *
+ *========================================================================*/
+PUBLIC void get_stats_info(struct vm_stats_info *vsi)
+{
+       yielded_t *yb;
+
+       vsi->vsi_cached = 0L;
+
+       for(yb = lru_youngest; yb; yb = yb->older)
+               vsi->vsi_cached += yb->len / VM_PAGE_SIZE;
+}
+
 /*========================================================================*
  *                             get_usage_info                            *
  *========================================================================*/
index 86c2a118de185b875fb475311e88dfd001d9b012..f41cfd3c1f06ccd75814632389806751561d173f 100644 (file)
@@ -173,7 +173,7 @@ PUBLIC int do_info(message *m)
        static struct vm_region_info vri[MAX_VRI_COUNT];
        struct vmproc *vmp;
        vir_bytes addr, size, next, ptr;
-       int r, pr, dummy, count;
+       int r, pr, dummy, count, free_pages, largest_contig;
 
        if (vm_isokendpt(m->m_source, &pr) != OK)
                return EINVAL;
@@ -185,7 +185,11 @@ PUBLIC int do_info(message *m)
        case VMIW_STATS:
                vsi.vsi_pagesize = VM_PAGE_SIZE;
                vsi.vsi_total = total_pages;
-               memstats(&dummy, &vsi.vsi_free, &vsi.vsi_largest);
+               memstats(&dummy, &free_pages, &largest_contig);
+               vsi.vsi_free = free_pages;
+               vsi.vsi_largest = largest_contig;
+
+               get_stats_info(&vsi);
 
                addr = (vir_bytes) &vsi;
                size = sizeof(vsi);