libsysactivity  0.6.5
memory.h
1 /*
2  * libsysactivity
3  * http://sourceforge.net/projects/libsysactivity/
4  * Copyright (c) 2009, 2010 Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
25 #ifndef SA_MEMORY_H_
26 #define SA_MEMORY_H_
27 
31 struct sa_memory {
32 #ifdef SA_MEMORY_TOTAL
33  uint64_t total;
34 #endif
35 #ifdef SA_MEMORY_FREE
36  uint64_t free;
37 #endif
38 #ifdef SA_MEMORY_ACTIVE
39  uint64_t active;
40 #endif
41 #ifdef SA_MEMORY_INACTIVE
42  uint64_t inactive;
43 #endif
44 #ifdef SA_MEMORY_BUFFERS
45  uint64_t buffers;
46 #endif
47 #ifdef SA_MEMORY_SWAP_TOTAL
48  uint64_t swap_total;
49 #endif
50 #ifdef SA_MEMORY_SWAP_FREE
51  uint64_t swap_free;
52 #endif
53 #ifdef SA_MEMORY_SWAP_CACHED
54  uint64_t swap_cached;
55 #endif
56 #ifdef SA_MEMORY_WIRED
57  uint64_t wired;
58 #endif
59 #ifdef SA_MEMORY_CACHED
60  uint64_t cached;
61 #endif
62 #ifdef SA_MEMORY_DIRTY
63  uint64_t dirty;
64 #endif
65 #ifdef SA_MEMORY_EXECUTABLE
66  uint64_t executable;
67 #endif
68 #ifdef SA_MEMORY_FILES
69  uint64_t files;
70 #endif
71 #ifdef SA_MEMORY_LOCKED
72  uint64_t locked;
73 #endif
74 };
75 
76 #ifdef SA_OPEN_MEMORY
77 
82 int sa_open_memory(void) SA_EXPORT;
83 #endif
84 
85 #ifdef SA_CLOSE_MEMORY
86 
91 int sa_close_memory(void) SA_EXPORT;
92 #endif
93 
99 int sa_get_memory(struct sa_memory* dst) SA_EXPORT SA_NONNULL;
100 
102 #endif /* SA_MEMORY_H_ */
uint64_t free
Unused amount of memory.
Definition: memory.h:36
uint64_t files
Memory used by cached file data.
Definition: memory.h:69
Definition: memory.h:31
int sa_open_memory(void) SA_EXPORT
uint64_t swap_free
Free amount of swap available.
Definition: memory.h:51
int sa_close_memory(void) SA_EXPORT
uint64_t wired
Memory not placed on any queue.
Definition: memory.h:57
uint64_t cached
Amount of cached memory.
Definition: memory.h:60
uint64_t active
Amount of memory in use or recently used.
Definition: memory.h:39
uint64_t swap_total
Total amount of swap present in the system.
Definition: memory.h:48
uint64_t buffers
Memory used for cached files. Useless for metrics nowadays.
Definition: memory.h:45
uint64_t executable
Memory used to hold executable data.
Definition: memory.h:66
int sa_get_memory(struct sa_memory *dst) SA_EXPORT SA_NONNULL
uint64_t dirty
Amount of memory waiting for been written to the disk.
Definition: memory.h:63
uint64_t swap_cached
Amount of swap that is cached.
Definition: memory.h:54
uint64_t inactive
Amount of memory that has not been recently used.
Definition: memory.h:42
uint64_t locked
Memory that can not be moved to swap.
Definition: memory.h:72
uint64_t total
Total amount of RAM available in the system.
Definition: memory.h:33