Last change
on this file since 9c32a1 was 58808e, checked in by Frederik Heber <heber@…>, 16 years ago |
Fixed testsuite, removed some minor bugs.
- TesselationUnitTest_SOURCES lacked memoryallocator stuff
- Free does not give a message anymore, as there can be no error.
- testsuite was fixed for suite 2 and 3, mostly due to changed options that were not accomodated for in the testsuite
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | /*
|
---|
2 | * \file memoryusageobserver.hpp
|
---|
3 | *
|
---|
4 | * This class represents a Singleton for observing memory usage.
|
---|
5 | */
|
---|
6 | #ifndef MEMORYUSAGEOBSERVER_HPP_
|
---|
7 | #define MEMORYUSAGEOBSERVER_HPP_
|
---|
8 |
|
---|
9 | using namespace std;
|
---|
10 |
|
---|
11 | // include config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #include <map>
|
---|
17 | #include <iostream>
|
---|
18 | #include <iomanip>
|
---|
19 | #include <fstream>
|
---|
20 | #include <sstream>
|
---|
21 | #include <math.h>
|
---|
22 | #include <string>
|
---|
23 | #include <typeinfo>
|
---|
24 |
|
---|
25 | class MemoryUsageObserver {
|
---|
26 | public:
|
---|
27 | static MemoryUsageObserver* getInstance();
|
---|
28 | static void purgeInstance();
|
---|
29 | void addMemory(void* pointer, size_t size);
|
---|
30 | void removeMemory(void* pointer, const char *msg = NULL);
|
---|
31 | size_t getUsedMemorySize();
|
---|
32 | size_t getMaximumUsedMemory();
|
---|
33 |
|
---|
34 | protected:
|
---|
35 | /** Do not call this constructor directly, use getInstance() instead. */
|
---|
36 | MemoryUsageObserver();
|
---|
37 | /** Do not call this destructor directly, use purgeInstance() instead. */
|
---|
38 | ~MemoryUsageObserver();
|
---|
39 |
|
---|
40 | private:
|
---|
41 | static MemoryUsageObserver* instance;
|
---|
42 | map<void*, size_t> memoryUsers;
|
---|
43 | size_t totalSize, maximumSize;
|
---|
44 | };
|
---|
45 | #endif /*MEMORYUSAGEOBSERVER_HPP_*/
|
---|
Note:
See
TracBrowser
for help on using the repository browser.