Panda3D
|
00001 // Filename: memoryUsagePointerCounts.h 00002 // Created by: drose (04Jun01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef MEMORYUSAGEPOINTERCOUNTS_H 00016 #define MEMORYUSAGEPOINTERCOUNTS_H 00017 00018 #include "pandabase.h" 00019 00020 #ifdef DO_MEMORY_USAGE 00021 00022 class MemoryInfo; 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : MemoryUsagePointerCounts 00026 // Description : This is a supporting class for MemoryUsage. It 00027 // tracks the relative counts of a number of pointers of 00028 // some type (or age), for use by TypeHistogram and 00029 // AgeHistogram. It's not exported from the DLL, and it 00030 // doesn't even exist if we're compiling NDEBUG. 00031 //////////////////////////////////////////////////////////////////// 00032 class MemoryUsagePointerCounts { 00033 public: 00034 INLINE MemoryUsagePointerCounts(); 00035 INLINE MemoryUsagePointerCounts(const MemoryUsagePointerCounts ©); 00036 INLINE void operator = (const MemoryUsagePointerCounts ©); 00037 00038 INLINE void clear(); 00039 void add_info(MemoryInfo *info); 00040 void output(ostream &out) const; 00041 00042 INLINE bool is_size_unknown() const; 00043 INLINE size_t get_size() const; 00044 INLINE int get_count() const; 00045 00046 INLINE bool operator < (const MemoryUsagePointerCounts &other) const; 00047 00048 private: 00049 static void output_bytes(ostream &out, size_t size); 00050 00051 private: 00052 int _count; 00053 int _unknown_size_count; 00054 size_t _size; 00055 }; 00056 00057 INLINE ostream &operator << (ostream &out, const MemoryUsagePointerCounts &c); 00058 00059 #include "memoryUsagePointerCounts.I" 00060 00061 #endif // DO_MEMORY_USAGE 00062 00063 #endif 00064