Predator  [unstable] git snapshot
memdebug.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Kamil Dudka <kdudka@redhat.com>
3  *
4  * This file is part of predator.
5  *
6  * predator is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * any later version.
10  *
11  * predator 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
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with predator. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef H_GUARD_MEM_DEBUG_H
21 #define H_GUARD_MEM_DEBUG_H
22 
23 #include <string>
24 #include <sys/types.h>
25 
26 /**
27  * @file memdebug.hh
28  * @todo some dox
29  */
30 
31 /// provide the raw amount of currently allocated memory (as glibc reports it)
32 bool rawMemUsage(ssize_t *pDst);
33 
34 /// initialize memory debugging, taking the current memory state as state zero
35 bool initMemDrift();
36 
37 /// provide relative amount of currently allocated memory (subtracting drift)
38 bool currentMemUsage(ssize_t *pDst);
39 
40 /// print the current amount of allocated memory
41 bool printMemUsage(const char *justCompletedFncName);
42 
43 /// print the peak over all calls of rawMemUsage(), but relative to the drift
44 bool printPeakMemUsage();
45 
46 #endif /* H_GUARD_MEM_DEBUG_H */