yast2-core
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
liby2util-r
src
include
y2util
MemUsage.h
Go to the documentation of this file.
1
/*-----------------------------------------------------------*- c++ -*-\
2
| |
3
| __ __ ____ _____ ____ |
4
| \ \ / /_ _/ ___|_ _|___ \ |
5
| \ V / _` \___ \ | | __) | |
6
| | | (_| |___) || | / __/ |
7
| |_|\__,_|____/ |_| |_____| |
8
| |
9
| core system |
10
| (C) SUSE LINUX AG |
11
\----------------------------------------------------------------------/
12
13
File: MemUsage.h
14
Author: Martin Vidner <mvidner@suse.cz>
15
16
$Id$
17
18
/-*/
19
20
#ifndef MemUsage_h
21
#define MemUsage_h
22
23
#include <set>
24
25
29
#undef D_MEMUSAGE
30
37
class
MemUsage
38
{
39
protected
:
40
typedef
std::set <MemUsage *>
data
;
41
static
data
*
m_mu_instances
;
42
43
MemUsage
() {
44
if
( !
m_mu_instances
)
45
{
46
m_mu_instances
=
new
data
;
47
}
48
m_mu_instances
->insert (
this
);
49
}
50
51
virtual
~MemUsage
() {
52
m_mu_instances
->erase (
this
);
53
}
54
public
:
56
static
void
MuDump
();
58
// ready to be printed in gdb
59
static
void
MuDumpVal
(
const
char
*name);
60
61
virtual
std::size_t
mem_size
()
const
{
return
sizeof
(*this); }
62
};
63
64
// this makes it easier for gdb.
65
void
MuDump
();
66
void
MuDumpVal
(
const
char
*name);
67
68
#endif
Generated on a sunny day for yast2-core by
1.8.2