1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! This module roughly corresponds to `mach/vm_statistics.h`

use vm_types::integer_t;

pub type vm_statistics_t = *mut vm_statistics;
pub type vm_statistics_data_t = vm_statistics;
pub type pmap_statistics_t = *mut pmap_statistics;

pub const VM_PAGE_QUERY_PAGE_PRESENT: integer_t    = (1 << 0);
pub const VM_PAGE_QUERY_PAGE_FICTITIOUS: integer_t = (1 << 1);
pub const VM_PAGE_QUERY_PAGE_REF: integer_t        = (1 << 2);
pub const VM_PAGE_QUERY_PAGE_DIRTY: integer_t      = (1 << 3);

pub const VM_MEMORY_MALLOC: ::libc::c_uint                  = 1;
pub const VM_MEMORY_MALLOC_SMALL: ::libc::c_uint            = 2;
pub const VM_MEMORY_MALLOC_LARGE: ::libc::c_uint            = 3;
pub const VM_MEMORY_MALLOC_HUGE: ::libc::c_uint             = 4;
pub const VM_MEMORY_SBRK: ::libc::c_uint                    = 5;
pub const VM_MEMORY_ANALYSIS_TOOL: ::libc::c_uint           = 10;
pub const VM_MEMORY_MACH_MSG: ::libc::c_uint                = 20;
pub const VM_MEMORY_IOKIT: ::libc::c_uint                   = 21;
pub const VM_MEMORY_STACK: ::libc::c_uint                   = 30;
pub const VM_MEMORY_GUARD: ::libc::c_uint                   = 31;
pub const VM_MEMORY_SHARED_PMAP: ::libc::c_uint             = 32;
pub const VM_MEMORY_DYLIB: ::libc::c_uint                   = 33;
pub const VM_MEMORY_APPKIT: ::libc::c_uint                  = 40;
pub const VM_MEMORY_FOUNDATION: ::libc::c_uint              = 41;
pub const VM_MEMORY_COREGRAPHICS: ::libc::c_uint            = 42;
pub const VM_MEMORY_CARBON: ::libc::c_uint                  = 43;
pub const VM_MEMORY_JAVA: ::libc::c_uint                    = 44;
pub const VM_MEMORY_ATS: ::libc::c_uint                     = 50;
pub const VM_MEMORY_DYLD: ::libc::c_uint                    = 60;
pub const VM_MEMORY_DYLD_MALLOC: ::libc::c_uint             = 61;
pub const VM_MEMORY_APPLICATION_SPECIFIC_1: ::libc::c_uint  = 240;
pub const VM_MEMORY_APPLICATION_SPECIFIC_16: ::libc::c_uint = 255;

pub const VM_FLAGS_FIXED: ::libc::c_int    = 0x0;
pub const VM_FLAGS_ANYWHERE: ::libc::c_int = 0x1;

pub struct vm_statistics {
    pub free_count: integer_t,
    pub active_count: integer_t,
    pub inactive_count: integer_t,
    pub wire_count: integer_t,
    pub zero_fill_count: integer_t,
    pub reactivations: integer_t,
    pub pageins: integer_t,
    pub pageouts: integer_t,
    pub faults: integer_t,
    pub cow_faults: integer_t,
    pub lookups: integer_t,
    pub hits: integer_t,
}

pub struct pmap_statistics {
    pub resident_count: integer_t,
    pub wired_count: integer_t,
}