+/*
+ * 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.
+ * rev4 - require 64-bit alignment for efficient access
+ * in the kernel. No change to reported data.
+ *
+ */
+
+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 */
+ uint64_t purges; /* # of pages purged */
+ natural_t purgeable_count; /* # of pages purgeable */
+ /*
+ * 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 */
+
+ /* added for rev1 */
+ uint64_t decompressions; /* # of pages decompressed */
+ uint64_t compressions; /* # of pages compressed */
+ uint64_t swapins; /* # of pages swapped in (via compression segments) */
+ uint64_t swapouts; /* # of pages swapped out (via compression segments) */
+ natural_t compressor_page_count; /* # of pages used by the compressed pager to hold all the compressed data */
+ natural_t throttled_count; /* # of pages throttled */
+ natural_t external_page_count; /* # of pages that are file-backed (non-swap) */
+ natural_t internal_page_count; /* # of pages that are anonymous */
+ uint64_t total_uncompressed_pages_in_compressor; /* # of pages (uncompressed) held within the compressor. */
+} __attribute__((aligned(8)));
+
+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)))
+
+/*
+ * vm_extmod_statistics
+ *
+ * Structure to record modifications to a task by an
+ * external agent.
+ *
+ * History:
+ * rev0 - original structure.
+ */
+
+struct vm_extmod_statistics {
+ int64_t task_for_pid_count; /* # of times task port was looked up */
+ int64_t task_for_pid_caller_count; /* # of times this task called task_for_pid */
+ int64_t thread_creation_count; /* # of threads created in task */
+ int64_t thread_creation_caller_count; /* # of threads created by task */
+ int64_t thread_set_state_count; /* # of register state sets in task */
+ int64_t thread_set_state_caller_count; /* # of register state sets by task */
+} __attribute__((aligned(8)));
+
+typedef struct vm_extmod_statistics *vm_extmod_statistics_t;
+typedef struct vm_extmod_statistics vm_extmod_statistics_data_t;
+
+typedef struct vm_purgeable_stat {
+ uint64_t count;
+ uint64_t size;
+}vm_purgeable_stat_t;
+
+struct vm_purgeable_info {
+ vm_purgeable_stat_t fifo_data[8];
+ vm_purgeable_stat_t obsolete_data;
+ vm_purgeable_stat_t lifo_data[8];
+};
+
+typedef struct vm_purgeable_info *vm_purgeable_info_t;