mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
add DO_MEMORY_USAGE
This commit is contained in:
parent
5800fa36e9
commit
48fbbe3aac
@ -35,7 +35,9 @@ TypeHandle AnimControl::_type_handle;
|
||||
////////////////////////////////////////////////////////////////////
|
||||
AnimControl::
|
||||
AnimControl(PartBundle *part, AnimBundle *anim, int channel_index) {
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, get_class_type());
|
||||
#endif
|
||||
|
||||
_part = part;
|
||||
_anim = anim;
|
||||
|
@ -133,7 +133,9 @@ TypeHandle GraphicsWindow::WindowPipe::force_init_type(void) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
GraphicsWindow::
|
||||
GraphicsWindow(GraphicsPipe *pipe) : Configurable() {
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, this);
|
||||
#endif
|
||||
_pipe = pipe;
|
||||
|
||||
_draw_callback = NULL;
|
||||
@ -150,7 +152,9 @@ GraphicsWindow(GraphicsPipe *pipe) : Configurable() {
|
||||
GraphicsWindow::
|
||||
GraphicsWindow(GraphicsPipe *pipe,
|
||||
const GraphicsWindow::Properties& props) : Configurable() {
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, this);
|
||||
#endif
|
||||
_pipe = pipe;
|
||||
_props = props;
|
||||
|
||||
|
@ -16,13 +16,13 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
// Nothing in this module gets compiled in NDEBUG mode.
|
||||
|
||||
#include "memoryInfo.h"
|
||||
#include "typedReferenceCount.h"
|
||||
#include "typeHandle.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
// Nothing in this module gets compiled in NDEBUG mode.
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MemoryInfo::Constructor
|
||||
// Access: Public
|
||||
|
@ -20,12 +20,14 @@
|
||||
#define MEMORYINFO_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
|
||||
#include "typeHandle.h"
|
||||
|
||||
class ReferenceCount;
|
||||
class TypedObject;
|
||||
|
||||
#ifndef NDEBUG
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : MemoryInfo
|
||||
// Description : This is a supporting class for MemoryUsage. It
|
||||
|
@ -16,6 +16,8 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
// Nothing in this module gets compiled in NDEBUG mode.
|
||||
|
||||
#include "memoryUsagePointers.h"
|
||||
#include "trueClock.h"
|
||||
@ -28,10 +30,6 @@
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
// Nothing in this module gets compiled in NDEBUG mode.
|
||||
|
||||
|
||||
#include "config_express.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -21,10 +21,11 @@
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
|
||||
#include "typedObject.h"
|
||||
#include "memoryInfo.h"
|
||||
#include "memoryUsagePointerCounts.h"
|
||||
|
||||
#include "pmap.h"
|
||||
#include "dallocator.h"
|
||||
|
||||
@ -198,6 +199,7 @@ private:
|
||||
};
|
||||
|
||||
#include "memoryUsage.I"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -16,13 +16,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
// Nothing in this module gets compiled in NDEBUG mode.
|
||||
|
||||
#include "memoryUsagePointerCounts.h"
|
||||
#include "memoryInfo.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
// Nothing in this module gets compiled in NDEBUG mode.
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MemoryUsagePointerCounts::add_info
|
||||
// Access: Public
|
||||
|
@ -21,9 +21,10 @@
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
|
||||
class MemoryInfo;
|
||||
|
||||
#ifndef NDEBUG
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : MemoryUsagePointerCounts
|
||||
// Description : This is a supporting class for MemoryUsage. It
|
||||
|
@ -16,14 +16,10 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "memoryUsagePointers.h"
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
// Nothing in this module gets compiled in NDEBUG mode.
|
||||
|
||||
|
||||
#include "memoryUsagePointers.h"
|
||||
#include "config_express.h"
|
||||
#include "referenceCount.h"
|
||||
#include "typedReferenceCount.h"
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
|
||||
#include "typedObject.h"
|
||||
#include "pointerTo.h"
|
||||
#include "referenceCount.h"
|
||||
|
||||
#include "pvector.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : MemoryUsagePointers
|
||||
// Description : This is a list of pointers returned by a MemoryUsage
|
||||
|
@ -73,7 +73,7 @@ reassign(To *ptr) {
|
||||
_ptr = ptr;
|
||||
if (_ptr != (To *)NULL) {
|
||||
_ptr->ref();
|
||||
#ifndef NDEBUG
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
if (MemoryUsage::get_track_memory_usage()) {
|
||||
// Make sure the MemoryUsage record knows what the TypeHandle
|
||||
// is, if we know it ourselves.
|
||||
|
@ -38,7 +38,7 @@ TypeHandle RefCountObj<Base>::_type_handle;
|
||||
INLINE ReferenceCount::
|
||||
ReferenceCount() {
|
||||
_ref_count = 0;
|
||||
#ifndef NDEBUG
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::record_pointer(this);
|
||||
#endif
|
||||
}
|
||||
@ -56,7 +56,7 @@ ReferenceCount() {
|
||||
INLINE ReferenceCount::
|
||||
ReferenceCount(const ReferenceCount &) {
|
||||
_ref_count = 0;
|
||||
#ifndef NDEBUG
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::record_pointer(this);
|
||||
#endif
|
||||
}
|
||||
@ -95,7 +95,7 @@ operator = (const ReferenceCount &) {
|
||||
INLINE ReferenceCount::
|
||||
~ReferenceCount() {
|
||||
prepare_delete();
|
||||
#ifndef NDEBUG
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::remove_pointer(this);
|
||||
#endif
|
||||
}
|
||||
|
@ -24,7 +24,9 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE TypedReferenceCount::
|
||||
TypedReferenceCount() {
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -37,7 +39,9 @@ TypedReferenceCount(const TypedReferenceCount ©) :
|
||||
TypedObject(copy),
|
||||
ReferenceCount(copy)
|
||||
{
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -27,7 +27,9 @@ TypeHandle dDrawable::_type_handle;
|
||||
////////////////////////////////////////////////////////////////////
|
||||
dDrawable::
|
||||
dDrawable() : WritableConfigurable() {
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -27,7 +27,9 @@ INLINE_GRAPH ArcChain::ArcComponent::
|
||||
ArcComponent(Node *node) :
|
||||
_next(NULL)
|
||||
{
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, get_class_type());
|
||||
#endif
|
||||
_p._node = node;
|
||||
nassertv(node != (Node *)NULL);
|
||||
_p._node->ref();
|
||||
@ -45,7 +47,9 @@ INLINE_GRAPH ArcChain::ArcComponent::
|
||||
ArcComponent(NodeRelation *arc, ArcComponent *next) :
|
||||
_next(next)
|
||||
{
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, get_class_type());
|
||||
#endif
|
||||
_p._arc = arc;
|
||||
nassertv(_next != (ArcComponent *)NULL);
|
||||
nassertv(arc != (NodeRelation *)NULL);
|
||||
@ -62,7 +66,9 @@ INLINE_GRAPH ArcChain::ArcComponent::
|
||||
ArcComponent(const ArcComponent ©) :
|
||||
_next(copy._next)
|
||||
{
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, get_class_type());
|
||||
#endif
|
||||
if (has_arc()) {
|
||||
_p._arc = copy._p._arc;
|
||||
nassertv(_p._arc != (NodeRelation *)NULL);
|
||||
|
@ -37,7 +37,9 @@ Node* const Node::Null = (Node*)0L;
|
||||
////////////////////////////////////////////////////////////////////
|
||||
Node::
|
||||
Node() {
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -55,7 +57,9 @@ Node(const Node ©) :
|
||||
BoundedObject(copy),
|
||||
ReferenceCount(copy)
|
||||
{
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -34,7 +34,9 @@ TypeHandle NodeTransitionCache::_type_handle;
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeTransitionCache::
|
||||
NodeTransitionCache() {
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, get_class_type());
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -46,7 +48,9 @@ NodeTransitionCache::
|
||||
NodeTransitionCache(const NodeTransitionCache ©) :
|
||||
_cache(copy._cache)
|
||||
{
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, get_class_type());
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -67,7 +71,9 @@ operator = (const NodeTransitionCache ©) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeTransitionCache::
|
||||
NodeTransitionCache(const NodeTransitions &nt) {
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, get_class_type());
|
||||
#endif
|
||||
|
||||
NodeTransitions::Transitions::const_iterator ti;
|
||||
for (ti = nt._transitions.begin();
|
||||
|
@ -26,5 +26,11 @@
|
||||
#include <dtoolbase.h>
|
||||
#include "pandasymbols.h"
|
||||
|
||||
#if defined(UNKNOWN_ALLOCATOR) || defined(NDEBUG)
|
||||
#undef DO_MEMORY_USAGE
|
||||
#else
|
||||
#define DO_MEMORY_USAGE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -377,6 +377,8 @@ main_tick() {
|
||||
// code inside the MemoryUsage class, where it fits a little better,
|
||||
// simply because MemoryUsage is a very low-level class that doesn't
|
||||
// know about PStatClient.
|
||||
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
if (MemoryUsage::has_total_size()) {
|
||||
_total_size_pcollector.set_level(MemoryUsage::get_total_size());
|
||||
}
|
||||
@ -386,6 +388,7 @@ main_tick() {
|
||||
if (MemoryUsage::has_interpreter_size()) {
|
||||
_interpreter_size_pcollector.set_level(MemoryUsage::get_interpreter_size());
|
||||
}
|
||||
#endif
|
||||
|
||||
get_global_pstats()->client_main_tick();
|
||||
}
|
||||
|
@ -24,7 +24,9 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE TypedWritableReferenceCount::
|
||||
TypedWritableReferenceCount() {
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -35,9 +37,10 @@ TypedWritableReferenceCount() {
|
||||
INLINE TypedWritableReferenceCount::
|
||||
TypedWritableReferenceCount(const TypedWritableReferenceCount ©) :
|
||||
TypedWritable(copy),
|
||||
ReferenceCount(copy)
|
||||
{
|
||||
ReferenceCount(copy) {
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user