WAVEWATCH III
beta 0.0.1
w3getmem.c
Go to the documentation of this file.
1
/* ------------------------------------------------------------------ */
2
/* function get_memory() */
3
/* */
4
/* +-----------------------------------+ */
5
/* | WAVEWATCH III NOAA/NCEP | */
6
/* | H. L. Tolman | */
7
/* | C | */
8
/* | Last update : 28-Jan-2014 | */
9
/* +-----------------------------------+ */
10
/* */
11
/* 28-Jan-2014 : Origination. ( version 5.00 ) */
12
/* */
13
/* 1. Purpose : */
14
/* */
15
/* Get memory use HWM in Mb for profiling purposes. */
16
/* */
17
/* 2. Method : */
18
/* */
19
/* C system calls, based on code mostly form Jim Abeles, provided */
20
/* by George Vandenberghe. */
21
/* */
22
/* 3. Parameters : */
23
/* */
24
/* 4. Subroutines used : */
25
/* */
26
/* 5. Called by : */
27
/* */
28
/* 6. Error messages : */
29
/* */
30
/* 7. Remarks : */
31
/* */
32
/* 8. Structure : */
33
/* */
34
/* See source code. */
35
/* */
36
/* 9. Source code : */
37
/* */
38
/* ------------------------------------------------------------------ */
39
40
#include <stdio.h>
41
#include <sys/resource.h>
42
43
double
get_memory_
(
void
)
44
45
{
46
long
Kbytes;
47
double
Mbytes;
48
struct
rusage RU;
49
50
getrusage(RUSAGE_SELF, &RU);
51
52
Kbytes = RU.ru_maxrss;
53
54
Mbytes = ((double) Kbytes) / 1024.0;
55
56
return
Mbytes;
57
}
58
59
/* End of get_memory ------------------------------------------------ */
get_memory_
double get_memory_(void)
Definition:
w3getmem.c:43
model
src
w3getmem.c
Generated by
1.8.17