/*
- * Copyright (c) 1999-2009 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 1999-2016 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
- *
+ *
* "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
* Reserved. This file contains Original Code and/or Modifications of
* Original Code as defined in and that are subject to the Apple Public
* except in compliance with the License. Please obtain a copy of the
* License at http://www.apple.com/publicsource and read it before using
* this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License."
- *
+ *
* @APPLE_LICENSE_HEADER_END@
*/
/*
*
* 25-mar-99 A.Ramesh at Apple
* Ported to MacOS X
- *
+ *
* 22-Jan-09 R.Branche at Apple
- * Changed some fields to 64-bit to alleviate overflows
+ * Changed some fields to 64-bit to alleviate overflows
************************************************************************
*/
#include <stdio.h>
#include <mach/mach.h>
+#include <mach/vm_page_size.h>
vm_statistics64_data_t vm_stat, last;
char *pgmname;
mach_port_t myHost;
-vm_size_t pageSize = 4096; /* set to 4k default */
void usage(void);
void snapshot(void);
int
main(int argc, char *argv[])
{
-
double delay = 0.0;
int count = 0;
myHost = mach_host_self();
- if(host_page_size(mach_host_self(), &pageSize) != KERN_SUCCESS) {
- fprintf(stderr, "%s: failed to get pagesize; defaulting to 4K.\n", pgmname);
- pageSize = 4096;
- }
-
if (delay == 0.0) {
snapshot();
} else {
void
snapshot(void)
{
-
get_stats(&vm_stat);
- printf("Mach Virtual Memory Statistics: (page size of %d bytes)\n",
- (int) (pageSize));
+ printf("Mach Virtual Memory Statistics: (page size of %llu bytes)\n", (mach_vm_size_t)vm_kernel_page_size);
sspstat("Pages free:", (uint64_t) (vm_stat.free_count - vm_stat.speculative_count));
sspstat("Pages active:", (uint64_t) (vm_stat.active_count));
{
get_stats(&vm_stat);
printf("Mach Virtual Memory Statistics: ");
- printf("(page size of %d bytes)\n",
- (int) (pageSize));
+ printf("(page size of %llu bytes)\n", (mach_vm_size_t)vm_kernel_page_size);
printf("%8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %11s %9s %8s %8s %8s %8s %8s %8s %8s %8s\n",
"free",
"active",