mach_sys/
vm_statistics.rs

1//! This module roughly corresponds to `mach/vm_statistics.h`
2
3use crate::ffi::{c_uint, c_int};
4
5use crate::vm_types::{integer_t, natural_t};
6
7pub const VM_PAGE_QUERY_PAGE_PRESENT:    integer_t = 1;
8pub const VM_PAGE_QUERY_PAGE_FICTITIOUS: integer_t = 1 << 1;
9pub const VM_PAGE_QUERY_PAGE_REF:        integer_t = 1 << 2;
10pub const VM_PAGE_QUERY_PAGE_DIRTY:      integer_t = 1 << 3;
11
12pub const VM_MEMORY_MALLOC:                  c_uint = 1;
13pub const VM_MEMORY_MALLOC_SMALL:            c_uint = 2;
14pub const VM_MEMORY_MALLOC_LARGE:            c_uint = 3;
15pub const VM_MEMORY_MALLOC_HUGE:             c_uint = 4;
16pub const VM_MEMORY_SBRK:                    c_uint = 5;
17pub const VM_MEMORY_ANALYSIS_TOOL:           c_uint = 10;
18pub const VM_MEMORY_MACH_MSG:                c_uint = 20;
19pub const VM_MEMORY_IOKIT:                   c_uint = 21;
20pub const VM_MEMORY_STACK:                   c_uint = 30;
21pub const VM_MEMORY_GUARD:                   c_uint = 31;
22pub const VM_MEMORY_SHARED_PMAP:             c_uint = 32;
23pub const VM_MEMORY_DYLIB:                   c_uint = 33;
24pub const VM_MEMORY_APPKIT:                  c_uint = 40;
25pub const VM_MEMORY_FOUNDATION:              c_uint = 41;
26pub const VM_MEMORY_COREGRAPHICS:            c_uint = 42;
27pub const VM_MEMORY_CARBON:                  c_uint = 43;
28pub const VM_MEMORY_JAVA:                    c_uint = 44;
29pub const VM_MEMORY_ATS:                     c_uint = 50;
30pub const VM_MEMORY_DYLD:                    c_uint = 60;
31pub const VM_MEMORY_DYLD_MALLOC:             c_uint = 61;
32pub const VM_MEMORY_APPLICATION_SPECIFIC_1:  c_uint = 240;
33pub const VM_MEMORY_APPLICATION_SPECIFIC_16: c_uint = 255;
34
35pub const VM_MEMORY_REALLOC:                 c_uint = 6;
36pub const VM_MEMORY_MALLOC_TINY:             c_uint = 7;
37pub const VM_MEMORY_MALLOC_LARGE_REUSABLE:   c_uint = 8;
38pub const VM_MEMORY_MALLOC_LARGE_REUSED:     c_uint = 9;
39pub const VM_MEMORY_MALLOC_NANO:             c_uint = 11;
40
41pub const VM_FLAGS_FIXED:     c_int = 0x0;
42pub const VM_FLAGS_ANYWHERE:  c_int = 0x1;
43pub const VM_FLAGS_OVERWRITE: c_int = 0x4000;
44
45#[repr(C)]
46#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
47pub struct vm_statistics {
48    pub free_count:        natural_t,
49    pub active_count:      natural_t,
50    pub inactive_count:    natural_t,
51    pub wire_count:        natural_t,
52    pub zero_fill_count:   natural_t,
53    pub reactivations:     natural_t,
54    pub pageins:           natural_t,
55    pub pageouts:          natural_t,
56    pub faults:            natural_t,
57    pub cow_faults:        natural_t,
58    pub lookups:           natural_t,
59    pub hits:              natural_t,
60    pub purgeable_count:   natural_t,
61    pub purges:            natural_t,
62    pub speculative_count: natural_t,
63}
64pub type vm_statistics_t      = *mut vm_statistics;
65pub type vm_statistics_data_t = vm_statistics;
66