Panda3D
memoryUsagePointerCounts.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file memoryUsagePointerCounts.h
10  * @author drose
11  * @date 2001-06-04
12  */
13 
14 #ifndef MEMORYUSAGEPOINTERCOUNTS_H
15 #define MEMORYUSAGEPOINTERCOUNTS_H
16 
17 #include "pandabase.h"
18 
19 class MemoryInfo;
20 
21 /**
22  * This is a supporting class for MemoryUsage. It tracks the relative counts
23  * of a number of pointers of some type (or age), for use by TypeHistogram and
24  * AgeHistogram. It's not exported from the DLL, and it doesn't even exist if
25  * we're compiling NDEBUG.
26  */
28 public:
29  INLINE MemoryUsagePointerCounts();
31  INLINE void operator = (const MemoryUsagePointerCounts &copy);
32 
33  INLINE void clear();
34  void add_info(MemoryInfo *info);
35  void output(std::ostream &out) const;
36 
37  INLINE bool is_size_unknown() const;
38  INLINE size_t get_size() const;
39  INLINE int get_count() const;
40 
41  INLINE bool operator < (const MemoryUsagePointerCounts &other) const;
42 
43 private:
44  static void output_bytes(std::ostream &out, size_t size);
45 
46 private:
47  int _count;
48  int _unknown_size_count;
49  size_t _size;
50 };
51 
52 INLINE std::ostream &operator << (std::ostream &out, const MemoryUsagePointerCounts &c);
53 
55 
56 #endif
void add_info(MemoryInfo *info)
Adds a pointer definition to the counter.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool is_size_unknown() const
Returns true if none of the pointers in the count have a known size, or false if at least one of them...
int get_count() const
Returns the total number of pointers in the count.
void clear()
Resets the counter to empty.
size_t get_size() const
Returns the total allocated size of all pointers in the count whose size is known.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a supporting class for MemoryUsage.