VM: expose secondary cache size

This commit is contained in:
David van Moolenbroek
2010-09-14 21:22:56 +00:00
parent 7763fd67c7
commit 3eb65448a6
5 changed files with 28 additions and 8 deletions

View 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,

View 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 *
*========================================================================*/

View 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);