]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/mach/vm_statistics.h
xnu-1504.9.17.tar.gz
[apple/xnu.git] / osfmk / mach / vm_statistics.h
index f0bdd1a4707cf23e177d286f36da43b3edc24fff..36a79fdd16aa7b314715ea1da31d37e64fe62446 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
 
 #include <mach/machine/vm_types.h>
 
+
+/*
+ * vm_statistics
+ *
+ * History:
+ *     rev0 -  original structure.
+ *     rev1 -  added purgable info (purgable_count and purges).
+ *     rev2 -  added speculative_count.
+ *
+ * Note: you cannot add any new fields to this structure. Add them below in
+ *      vm_statistics64.
+ */
+
 struct vm_statistics {
        natural_t       free_count;             /* # of pages free */
        natural_t       active_count;           /* # of pages active */
@@ -96,9 +109,76 @@ struct vm_statistics {
        natural_t       speculative_count;      /* # of pages speculative */
 };
 
+/* Used by all architectures */
 typedef struct vm_statistics   *vm_statistics_t;
 typedef struct vm_statistics   vm_statistics_data_t;
 
+#if defined(__ppc__) /* On ppc, vm statistics are still 32-bit */
+
+typedef struct vm_statistics   *vm_statistics64_t;
+typedef struct vm_statistics   vm_statistics64_data_t;
+
+#define VM_STATISTICS_TRUNCATE_TO_32_BIT(value) value
+
+#else /* !(defined(__ppc__))  */
+
+/* 
+ * vm_statistics64
+ *
+ * History:
+ *     rev0 -  original structure.
+ *     rev1 -  added purgable info (purgable_count and purges).
+ *     rev2 -  added speculative_count.
+ *        ----
+ *     rev3 -  changed name to vm_statistics64.
+ *             changed some fields in structure to 64-bit on 
+ *             arm, i386 and x86_64 architectures.
+ *
+ */
+
+struct vm_statistics64 {
+       natural_t       free_count;             /* # of pages free */
+       natural_t       active_count;           /* # of pages active */
+       natural_t       inactive_count;         /* # of pages inactive */
+       natural_t       wire_count;             /* # of pages wired down */
+       uint64_t        zero_fill_count;        /* # of zero fill pages */
+       uint64_t        reactivations;          /* # of pages reactivated */
+       uint64_t        pageins;                /* # of pageins */
+       uint64_t        pageouts;               /* # of pageouts */
+       uint64_t        faults;                 /* # of faults */
+       uint64_t        cow_faults;             /* # of copy-on-writes */
+       uint64_t        lookups;                /* object cache lookups */
+       uint64_t        hits;                   /* object cache hits */
+
+       /* added for rev1 */
+       uint64_t        purges;                 /* # of pages purged */
+       natural_t       purgeable_count;        /* # of pages purgeable */
+
+       /* added for rev2 */
+       /*
+        * NB: speculative pages are already accounted for in "free_count",
+        * so "speculative_count" is the number of "free" pages that are
+        * used to hold data that was read speculatively from disk but
+        * haven't actually been used by anyone so far.
+        */
+       natural_t       speculative_count;      /* # of pages speculative */
+
+}
+;
+
+typedef struct vm_statistics64 *vm_statistics64_t;
+typedef struct vm_statistics64 vm_statistics64_data_t;
+
+/* 
+ * VM_STATISTICS_TRUNCATE_TO_32_BIT
+ *
+ * This is used by host_statistics() to truncate and peg the 64-bit in-kernel values from
+ * vm_statistics64 to the 32-bit values of the older structure above (vm_statistics).
+ */
+#define VM_STATISTICS_TRUNCATE_TO_32_BIT(value) ((uint32_t)(((value) > UINT32_MAX ) ? UINT32_MAX : (value)))
+
+#endif /* !(defined(__ppc__)) */
+
 
 /* included for the vm_map_page_query call */
 
@@ -109,6 +189,7 @@ typedef struct vm_statistics        vm_statistics_data_t;
 #define VM_PAGE_QUERY_PAGE_PAGED_OUT    0x10
 #define VM_PAGE_QUERY_PAGE_COPIED       0x20
 #define VM_PAGE_QUERY_PAGE_SPECULATIVE 0x40
+#define VM_PAGE_QUERY_PAGE_EXTERNAL    0x80
 #define VM_PAGE_QUERY_PAGE_CS_VALIDATED        0x100
 #define VM_PAGE_QUERY_PAGE_CS_TAINTED  0x200
 
@@ -163,16 +244,32 @@ typedef struct pmap_statistics    *pmap_statistics_t;
 #define VM_FLAGS_ANYWHERE      0x0001
 #define VM_FLAGS_PURGABLE      0x0002
 #define VM_FLAGS_NO_CACHE      0x0010
-
 #ifdef KERNEL_PRIVATE
-#define VM_FLAGS_NO_PMAP_CHECK 0x8000  /* do not check that pmap is empty */
-#define VM_FLAGS_OVERWRITE     0x4000  /* delete any existing mappings first */
-#define VM_FLAGS_BEYOND_MAX    0x2000  /* map beyond the map's limits */
-#define VM_FLAGS_ALREADY       0x1000  /* OK if same mapping already exists */
+#define VM_FLAGS_BELOW_MIN     0x0080  /* map below the map's min offset */
+#define VM_FLAGS_PERMANENT     0x0100  /* mapping can NEVER be unmapped */
+#define VM_FLAGS_GUARD_AFTER   0x0200  /* guard page after the mapping */
+#define VM_FLAGS_GUARD_BEFORE  0x0400  /* guard page before the mapping */
 #define VM_FLAGS_SUBMAP                0x0800  /* mapping a VM submap */
+#define VM_FLAGS_ALREADY       0x1000  /* OK if same mapping already exists */
+#define VM_FLAGS_BEYOND_MAX    0x2000  /* map beyond the map's max offset */
+#define VM_FLAGS_OVERWRITE     0x4000  /* delete any existing mappings first */
+#define VM_FLAGS_NO_PMAP_CHECK 0x8000  /* do not check that pmap is empty */
 #endif /* KERNEL_PRIVATE */
-#define VM_FLAGS_GUARD_BEFORE  0x0010
-#define VM_FLAGS_GUARD_AFTER   0x0020
+
+/*
+ * VM_FLAGS_SUPERPAGE_MASK
+ *     3 bits that specify whether large pages should be used instead of
+ *     base pages (!=0), as well as the requested page size.
+ */
+#define VM_FLAGS_SUPERPAGE_MASK        0x70000 /* bits 0x10000, 0x20000, 0x40000 */
+#define VM_FLAGS_SUPERPAGE_SHIFT 16
+
+#define SUPERPAGE_NONE                 0       /* no superpages, if all bits are 0 */
+#define VM_FLAGS_SUPERPAGE_NONE                (SUPERPAGE_NONE<<VM_FLAGS_SUPERPAGE_SHIFT)
+#if defined(__x86_64__) || !defined(KERNEL)
+#define SUPERPAGE_SIZE_2MB             1
+#define VM_FLAGS_SUPERPAGE_SIZE_2MB    (SUPERPAGE_SIZE_2MB<<VM_FLAGS_SUPERPAGE_SHIFT)
+#endif
 
 #define VM_FLAGS_ALIAS_MASK    0xFF000000
 #define VM_GET_FLAGS_ALIAS(flags, alias)                       \
@@ -186,6 +283,7 @@ typedef struct pmap_statistics      *pmap_statistics_t;
                                 VM_FLAGS_ANYWHERE |            \
                                 VM_FLAGS_PURGABLE |            \
                                 VM_FLAGS_NO_CACHE |            \
+                                VM_FLAGS_SUPERPAGE_MASK |      \
                                 VM_FLAGS_ALIAS_MASK)
 #define VM_FLAGS_USER_MAP      VM_FLAGS_USER_ALLOCATE
 
@@ -196,6 +294,8 @@ typedef struct pmap_statistics      *pmap_statistics_t;
 #define VM_MEMORY_SBRK 5// uninteresting -- no one should call
 #define VM_MEMORY_REALLOC 6
 #define VM_MEMORY_MALLOC_TINY 7
+#define VM_MEMORY_MALLOC_LARGE_REUSABLE 8
+#define VM_MEMORY_MALLOC_LARGE_REUSED 9
 
 #define VM_MEMORY_ANALYSIS_TOOL 10
 
@@ -206,6 +306,7 @@ typedef struct pmap_statistics      *pmap_statistics_t;
 #define        VM_MEMORY_SHARED_PMAP 32
 /* memory containing a dylib */
 #define VM_MEMORY_DYLIB        33
+#define VM_MEMORY_OBJC_DISPATCHERS 34
 
 // Placeholders for now -- as we analyze the libraries and find how they
 // use memory, we can make these labels more specific.
@@ -239,6 +340,18 @@ typedef struct pmap_statistics     *pmap_statistics_t;
 /* malloc'd memory created by dyld */
 #define VM_MEMORY_DYLD_MALLOC 61
 
+/* Used for sqlite page cache */
+#define VM_MEMORY_SQLITE 62
+
+/* JavaScriptCore heaps */
+#define VM_MEMORY_JAVASCRIPT_CORE 63
+/* memory allocated for the JIT */
+#define VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR 64
+#define VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE 65
+
+/* memory allocated for GLSL */
+#define VM_MEMORY_GLSL  66
+
 /* Reserve 240-255 for application */
 #define VM_MEMORY_APPLICATION_SPECIFIC_1 240
 #define VM_MEMORY_APPLICATION_SPECIFIC_16 255