MOS Source Code
Loading...
Searching...
No Matches
mmstat.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2#pragma once
3
4#include <mos/types.h>
5
6typedef enum
7{
8 MEM_PAGETABLE, // page table pages
9 MEM_SLAB, // slab allocator
10 MEM_PAGECACHE, // page cache
11 MEM_KERNEL, // kernel memory (e.g. kernel stack)
12 MEM_USER, // user memory (e.g. user code, data, stack)
13
16
17extern const char *mem_type_names[_MEM_MAX_TYPES];
18
25void mmstat_inc(mmstat_type_t type, size_t size);
26#define mmstat_inc1(type) mmstat_inc(type, 1)
27
34void mmstat_dec(mmstat_type_t type, size_t size);
35#define mmstat_dec1(type) mmstat_dec(type, 1)
36
63typedef struct
64{
65 size_t regular;
66 size_t pagecache;
67 size_t cow;
69
70#define vmap_stat_inc(vmap, type) (vmap)->stat.type += 1
71#define vmap_stat_dec(vmap, type) (vmap)->stat.type -= 1
void mmstat_dec(mmstat_type_t type, size_t size)
Decrement the memory usage statistics.
Definition mmstat.c:39
void mmstat_inc(mmstat_type_t type, size_t size)
Increment the memory usage statistics.
Definition mmstat.c:33
mmstat_type_t
Definition mmstat.h:7
@ _MEM_MAX_TYPES
Definition mmstat.h:14
@ MEM_PAGECACHE
Definition mmstat.h:10
@ MEM_USER
Definition mmstat.h:12
@ MEM_PAGETABLE
Definition mmstat.h:8
@ MEM_SLAB
Definition mmstat.h:9
@ MEM_KERNEL
Definition mmstat.h:11
const char * mem_type_names[_MEM_MAX_TYPES]
Definition mmstat.c:25
size_t size
Definition slab.c:30
Memory usage statistics for a specific vmap area.
Definition mmstat.h:64
size_t pagecache
pages that are in the page cache (file-backed only)
Definition mmstat.h:66
size_t cow
pages that are copy-on-write
Definition mmstat.h:67
size_t regular
regular pages with no special flags being set or unset
Definition mmstat.h:65