memoryUsagePointerCounts.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Filename: memoryUsagePointerCounts.h
  2. // Created by: drose (04Jun01)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef MEMORYUSAGEPOINTERCOUNTS_H
  19. #define MEMORYUSAGEPOINTERCOUNTS_H
  20. #include <pandabase.h>
  21. #ifdef DO_MEMORY_USAGE
  22. class MemoryInfo;
  23. ////////////////////////////////////////////////////////////////////
  24. // Class : MemoryUsagePointerCounts
  25. // Description : This is a supporting class for MemoryUsage. It
  26. // tracks the relative counts of a number of pointers of
  27. // some type (or age), for use by TypeHistogram and
  28. // AgeHistogram. It's not exported from the DLL, and it
  29. // doesn't even exist if we're compiling NDEBUG.
  30. ////////////////////////////////////////////////////////////////////
  31. class MemoryUsagePointerCounts {
  32. public:
  33. INLINE MemoryUsagePointerCounts();
  34. INLINE MemoryUsagePointerCounts(const MemoryUsagePointerCounts &copy);
  35. INLINE void operator = (const MemoryUsagePointerCounts &copy);
  36. INLINE void clear();
  37. void add_info(MemoryInfo &info);
  38. void output(ostream &out) const;
  39. INLINE bool is_size_unknown() const;
  40. INLINE size_t get_size() const;
  41. INLINE int get_count() const;
  42. INLINE bool operator < (const MemoryUsagePointerCounts &other) const;
  43. private:
  44. static void output_bytes(ostream &out, size_t size);
  45. private:
  46. int _count;
  47. int _unknown_size_count;
  48. size_t _size;
  49. };
  50. INLINE ostream &operator << (ostream &out, const MemoryUsagePointerCounts &c);
  51. #include "memoryUsagePointerCounts.I"
  52. #endif // NDEBUG
  53. #endif