1
#ifndef __BFT_MEM_USAGE_H__
2
#define __BFT_MEM_USAGE_H__
4
/*============================================================================
5
* Base memory usage information (System and Library dependent)
6
*============================================================================*/
9
This file is part of Code_Saturne, a general-purpose CFD tool.
11
Copyright (C) 1998-2011 EDF S.A.
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
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
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.
28
/*----------------------------------------------------------------------------*/
31
* Obtain definitions such as that of size_t through stddef.h (C99 standard)
32
* if available (preferred method), or through stdlib.h (which defines
33
* malloc() and family and so must define size_t some way) otherwise.
36
#if defined(__STDC_VERSION__)
37
# if (__STDC_VERSION__ == 199901L)
46
/* BFT library headers */
48
/*-----------------------------------------------------------------------------*/
53
} /* Fake brace to force Emacs auto-indentation back to column 0 */
55
#endif /* __cplusplus */
57
/*============================================================================
59
*============================================================================*/
61
/*============================================================================
62
* Public function prototypes
63
*============================================================================*/
66
* Initialize memory usage count depending on system.
68
* This functions checks if it has already been called, so
69
* it is safe to call more than once (though it is not
70
* thread-safe). Only the first call is effective.
74
bft_mem_usage_init(void);
77
* End memory usage count depending on system.
81
bft_mem_usage_end(void);
84
* Indicates if bft_mem_usage_...() functions are initialized.
87
* 1 if bft_mem_usage_init has been called, 0 otherwise.
91
bft_mem_usage_initialized(void);
94
* Return current process memory use (in kB) depending on OS.
98
bft_mem_usage_pr_size(void);
101
* Return maximum process memory use (in kB) depending on OS.
103
* The returned value is the maximum returned by bft_mem_usage_pr_size()
104
* during the program's lifetime. With memory allocations which return
105
* memory to the system, this value could be incorrect in certain cases.
109
bft_mem_usage_max_pr_size(void);
112
* Return counter to number of calls to malloc, realloc, and free.
114
* This function returns zeroes when the appropriate instrumentation
119
bft_mem_usage_n_calls(size_t count[3]);
121
/*----------------------------------------------------------------------------*/
125
#endif /* __cplusplus */
127
#endif /* __BFT_MEM_USAGE_H__ */