#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 {
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++;
_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,
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 *
*========================================================================*/
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;
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);