My Project
programmer's 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-2019 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 returned by bft_mem_usage_pr_size()
83  * during the program's lifetime. With memory allocations which return
84  * memory to the system, this value could be incorrect in certain cases.
85  */
86 
87 size_t
89 
90 /*
91  * Return counter to number of calls to malloc, realloc, and free.
92  *
93  * This function returns zeroes when the appropriate instrumentation
94  * is not available.
95  */
96 
97 void
98 bft_mem_usage_n_calls(size_t count[3]);
99 
100 /*----------------------------------------------------------------------------*/
101 
103 
104 #endif /* __BFT_MEM_USAGE_H__ */
cs_defs.h
bft_mem_usage_n_calls
void bft_mem_usage_n_calls(size_t count[3])
Definition: bft_mem_usage.c:754
bft_mem_usage_init
void bft_mem_usage_init(void)
Initialize memory usage count depending on system.
Definition: bft_mem_usage.c:452
bft_mem_usage_pr_size
size_t bft_mem_usage_pr_size(void)
Return current process memory use (in kB) depending on system.
Definition: bft_mem_usage.c:723
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
bft_mem_usage_max_pr_size
size_t bft_mem_usage_max_pr_size(void)
Definition: bft_mem_usage.c:739
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
bft_mem_usage_initialized
int bft_mem_usage_initialized(void)
Indicates if bft_mem_usage_...() functions are initialized.
Definition: bft_mem_usage.c:497
bft_mem_usage_end
void bft_mem_usage_end(void)
End memory usage count depending on system.
Definition: bft_mem_usage.c:483