From: David van Moolenbroek Date: Tue, 14 Sep 2010 21:22:56 +0000 (+0000) Subject: VM: expose secondary cache size X-Git-Tag: v3.2.0~880 X-Git-Url: http://zhaoyanbai.com/repos/icons/debian/static/datamaps.china.min.js?a=commitdiff_plain;h=3eb65448a64db068c3ca46edbd161a514e7e7e66;p=minix.git VM: expose secondary cache size --- diff --git a/include/minix/vm.h b/include/minix/vm.h index 2a65ffa5c..63bc35925 100644 --- a/include/minix/vm.h +++ b/include/minix/vm.h @@ -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 { diff --git a/servers/is/dmp_vm.c b/servers/is/dmp_vm.c index a999ed7cd..02f02ac0b 100644 --- a/servers/is/dmp_vm.c +++ b/servers/is/dmp_vm.c @@ -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++; diff --git a/servers/vm/proto.h b/servers/vm/proto.h index 48bf11876..00d243f9b 100644 --- a/servers/vm/proto.h +++ b/servers/vm/proto.h @@ -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, diff --git a/servers/vm/region.c b/servers/vm/region.c index 3fd760fa4..362f15626 100644 --- a/servers/vm/region.c +++ b/servers/vm/region.c @@ -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 * *========================================================================*/ diff --git a/servers/vm/utility.c b/servers/vm/utility.c index 86c2a118d..f41cfd3c1 100644 --- a/servers/vm/utility.c +++ b/servers/vm/utility.c @@ -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);