7.0
general documentation
bft_mem_usage.h
Go to the documentation of this file.
1 #ifndef __BFT_MEM_USAGE_H__
2 #define __BFT_MEM_USAGE_H__
3 
4 /*============================================================================
5  * Base memory usage information (System and Library dependent)
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2021 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 #include "cs_defs.h"
31 
32 /*----------------------------------------------------------------------------*/
33 
35 
36 /*============================================================================
37  * Public types
38  *============================================================================*/
39 
40 /*============================================================================
41  * Public function prototypes
42  *============================================================================*/
43 
44 /*
45  * Initialize memory usage count depending on system.
46  *
47  * This functions checks if it has already been called, so
48  * it is safe to call more than once (though it is not
49  * thread-safe). Only the first call is effective.
50  */
51 
52 void
53 bft_mem_usage_init(void);
54 
55 /*
56  * End memory usage count depending on system.
57  */
58 
59 void
60 bft_mem_usage_end(void);
61 
62 /*
63  * Indicates if bft_mem_usage_...() functions are initialized.
64  *
65  * returns:
66  * 1 if bft_mem_usage_init has been called, 0 otherwise.
67  */
68 
69 int
71 
72 /*
73  * Return current process memory use (in kB) depending on OS.
74  */
75 
76 size_t
78 
79 /*
80  * Return maximum process memory use (in kB) depending on OS.
81  *
82  * The returned value is the maximum memory used during the program's
83  * lifetime.
84  *
85  * returns:
86  * maximum measured program size, or 0 if not available
87  */
88 
89 size_t
91 
92 /*
93  * Return maximum process virtual memory use (in kB) depending on OS.
94  *
95  * returns:
96  * maximum measured virtual memory usage, or 0 if not available
97  */
98 
99 size_t
101 
102 /*
103  * Return shared library memory use (in kB) depending on OS.
104  *
105  * returns:
106  * maximum measured shared library memory usage, or 0 if not available
107  */
108 
109 size_t
111 
112 /*
113  * Return counter to number of calls to malloc, realloc, and free.
114  *
115  * This function returns zeroes when the appropriate instrumentation
116  * is not available.
117  */
118 
119 void
120 bft_mem_usage_n_calls(size_t count[3]);
121 
122 /*----------------------------------------------------------------------------*/
123 
125 
126 #endif /* __BFT_MEM_USAGE_H__ */
size_t bft_mem_usage_pr_size(void)
Return current process memory use (in kB) depending on system.
Definition: bft_mem_usage.c:733
void bft_mem_usage_init(void)
Initialize memory usage count depending on system.
Definition: bft_mem_usage.c:448
size_t bft_mem_usage_shared_lib_size(void)
Definition: bft_mem_usage.c:779
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
size_t bft_mem_usage_max_pr_size(void)
Definition: bft_mem_usage.c:750
size_t bft_mem_usage_max_vm_size(void)
Definition: bft_mem_usage.c:764
int bft_mem_usage_initialized(void)
Indicates if bft_mem_usage_...() functions are initialized.
Definition: bft_mem_usage.c:493
#define END_C_DECLS
Definition: cs_defs.h:496
void bft_mem_usage_n_calls(size_t count[3])
Definition: bft_mem_usage.c:794
void bft_mem_usage_end(void)
End memory usage count depending on system.
Definition: bft_mem_usage.c:479