mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
repair pstats mem tracking
This commit is contained in:
parent
af64f6a404
commit
8b76075133
@ -57,9 +57,9 @@ class pset : public set<Key, Compare, pallocator_single<Key> > {
|
||||
public:
|
||||
typedef pallocator_single<Key> allocator;
|
||||
typedef set<Key, Compare, allocator> base_class;
|
||||
pset(TypeHandle type_handle = pmap_type_handle) : base_class(Compare(), allocator(type_handle)) { }
|
||||
pset(TypeHandle type_handle = pset_type_handle) : base_class(Compare(), allocator(type_handle)) { }
|
||||
pset(const pset<Key, Compare> ©) : base_class(copy) { }
|
||||
pset(const Compare &comp, TypeHandle type_handle = pmap_type_handle) : base_class(comp, type_handle) { }
|
||||
pset(const Compare &comp, TypeHandle type_handle = pset_type_handle) : base_class(comp, type_handle) { }
|
||||
|
||||
#ifdef USE_TAU
|
||||
std::pair<TYPENAME base_class::iterator, bool>
|
||||
@ -118,9 +118,9 @@ template<class Key, class Compare = less<Key> >
|
||||
class pmultiset : public multiset<Key, Compare, pallocator_single<Key> > {
|
||||
public:
|
||||
typedef pallocator_single<Key> allocator;
|
||||
pmultiset(TypeHandle type_handle = pmap_type_handle) : multiset<Key, Compare, allocator>(Compare(), allocator(type_handle)) { }
|
||||
pmultiset(TypeHandle type_handle = pset_type_handle) : multiset<Key, Compare, allocator>(Compare(), allocator(type_handle)) { }
|
||||
pmultiset(const pmultiset<Key, Compare> ©) : multiset<Key, Compare, allocator>(copy) { }
|
||||
pmultiset(const Compare &comp, TypeHandle type_handle = pmap_type_handle) : multiset<Key, Compare, allocator>(comp, type_handle) { }
|
||||
pmultiset(const Compare &comp, TypeHandle type_handle = pset_type_handle) : multiset<Key, Compare, allocator>(comp, type_handle) { }
|
||||
};
|
||||
|
||||
#ifdef HAVE_STL_HASH
|
||||
|
@ -59,6 +59,7 @@ inc_memory_usage(MemoryClass memory_class, int size) {
|
||||
TypeRegistryNode *rnode = TypeRegistry::ptr()->look_up(*this, NULL);
|
||||
assert(rnode != (TypeRegistryNode *)NULL);
|
||||
AtomicAdjust::add(rnode->_memory_usage[memory_class], (PN_int32)size);
|
||||
assert(rnode->_memory_usage[memory_class] >= 0);
|
||||
}
|
||||
}
|
||||
#endif // DO_MEMORY_USAGE
|
||||
@ -77,6 +78,7 @@ dec_memory_usage(MemoryClass memory_class, int size) {
|
||||
TypeRegistryNode *rnode = TypeRegistry::ptr()->look_up(*this, NULL);
|
||||
assert(rnode != (TypeRegistryNode *)NULL);
|
||||
AtomicAdjust::add(rnode->_memory_usage[memory_class], -(PN_int32)size);
|
||||
assert(rnode->_memory_usage[memory_class] >= 0);
|
||||
}
|
||||
}
|
||||
#endif // DO_MEMORY_USAGE
|
||||
|
@ -131,7 +131,7 @@ PUBLISHED:
|
||||
void inc_memory_usage(MemoryClass memory_class, int size);
|
||||
void dec_memory_usage(MemoryClass memory_class, int size);
|
||||
#else
|
||||
INLINE size_t get_memory_usage(MemoryClass) const { return 0; }
|
||||
INLINE int get_memory_usage(MemoryClass) const { return 0; }
|
||||
INLINE void inc_memory_usage(MemoryClass, int) { }
|
||||
INLINE void dec_memory_usage(MemoryClass, int) { }
|
||||
#endif // DO_MEMORY_USAGE
|
||||
|
@ -491,7 +491,8 @@ sort_declarations() {
|
||||
// need to be recomputed all that often.
|
||||
_unique_declarations.clear();
|
||||
|
||||
pset<string> already_added(TypeHandle::none());
|
||||
init_system_type_handles(); // Make sure pset_type_handle is initted.
|
||||
pset<string> already_added;
|
||||
for (di = _trusted_declarations.begin();
|
||||
di != _trusted_declarations.end();
|
||||
++di) {
|
||||
|
@ -33,12 +33,12 @@
|
||||
#include "clockObject.h"
|
||||
#include "neverFreeMemory.h"
|
||||
|
||||
PStatCollector PStatClient::_total_size_pcollector("Main memory");
|
||||
PStatCollector PStatClient::_cpp_size_pcollector("Main memory:C++");
|
||||
PStatCollector PStatClient::_cpp_other_size_pcollector("Main memory:C++:Other");
|
||||
PStatCollector PStatClient::_nf_unused_size_pcollector("Main memory:NeverFree:Unused");
|
||||
PStatCollector PStatClient::_nf_other_size_pcollector("Main memory:NeverFree:Other");
|
||||
PStatCollector PStatClient::_interpreter_size_pcollector("Main memory:Interpreter");
|
||||
PStatCollector PStatClient::_nf_unused_size_pcollector("Track memory 1:NeverFree:Unused");
|
||||
PStatCollector PStatClient::_nf_other_size_pcollector("Track memory 1:NeverFree:Other");
|
||||
PStatCollector PStatClient::_cpp_other_size_pcollector("Track memory 1:Heap:Other");
|
||||
PStatCollector PStatClient::_total_size_pcollector("Track memory 2");
|
||||
PStatCollector PStatClient::_cpp_size_pcollector("Track memory 2:C++");
|
||||
PStatCollector PStatClient::_interpreter_size_pcollector("Track memory 2:Interpreter");
|
||||
PStatCollector PStatClient::_pstats_pcollector("*:PStats");
|
||||
PStatCollector PStatClient::_clock_wait_pcollector("Wait:Clock Wait:Sleep");
|
||||
PStatCollector PStatClient::_clock_busy_wait_pcollector("Wait:Clock Wait:Spin");
|
||||
@ -219,7 +219,7 @@ main_tick() {
|
||||
_total_size_pcollector.set_level(MemoryUsage::get_total_size());
|
||||
}
|
||||
if (MemoryUsage::has_cpp_size()) {
|
||||
_cpp_size_pcollector.set_level(MemoryUsage::get_cpp_size() - NeverFreeMemory::get_total_alloc());
|
||||
_cpp_size_pcollector.set_level(MemoryUsage::get_cpp_size());
|
||||
}
|
||||
if (MemoryUsage::has_interpreter_size()) {
|
||||
_interpreter_size_pcollector.set_level(MemoryUsage::get_interpreter_size());
|
||||
@ -277,10 +277,10 @@ main_tick() {
|
||||
break;
|
||||
|
||||
default:
|
||||
category = "C++";
|
||||
category = "Heap";
|
||||
}
|
||||
ostringstream strm;
|
||||
strm << "Main memory:" << category << ":" << type << ":" << mc;
|
||||
strm << "Track memory 1:" << category << ":" << type << ":" << mc;
|
||||
col = PStatCollector(strm.str());
|
||||
}
|
||||
col.set_level(usage);
|
||||
|
@ -227,11 +227,11 @@ private:
|
||||
|
||||
PStatClientImpl *_impl;
|
||||
|
||||
static PStatCollector _total_size_pcollector;
|
||||
static PStatCollector _cpp_size_pcollector;
|
||||
static PStatCollector _cpp_other_size_pcollector;
|
||||
static PStatCollector _nf_unused_size_pcollector;
|
||||
static PStatCollector _nf_other_size_pcollector;
|
||||
static PStatCollector _cpp_other_size_pcollector;
|
||||
static PStatCollector _total_size_pcollector;
|
||||
static PStatCollector _cpp_size_pcollector;
|
||||
static PStatCollector _interpreter_size_pcollector;
|
||||
static PStatCollector _pstats_pcollector;
|
||||
static PStatCollector _clock_wait_pcollector;
|
||||
|
@ -196,10 +196,12 @@ static LevelCollectorProperties level_properties[] = {
|
||||
{ 1, "State changes:Textures", { 0.8, 0.2, 0.2 } },
|
||||
{ 1, "Occlusion tests", { 0.9, 0.8, 0.3 }, "", 500.0 },
|
||||
{ 1, "Occlusion results", { 0.3, 0.9, 0.8 }, "", 500.0 },
|
||||
{ 1, "Main memory", { 0.5, 1.0, 0.5 }, "MB", 64, 1048576 },
|
||||
{ 1, "Main memory:C++", { 0.2, 0.2, 1.0 } },
|
||||
{ 1, "Main memory:NeverFree", { 0.2, 0.5, 0.8 } },
|
||||
{ 1, "Main memory:Interpreter", { 0.8, 0.2, 0.5 } },
|
||||
{ 1, "Track memory 1", { 0.5, 1.0, 0.5 }, "MB", 64, 1048576 },
|
||||
{ 1, "Track memory 1:Heap", { 0.8, 0.2, 1.0 } },
|
||||
{ 1, "Track memory 1:NeverFree", { 0.2, 0.5, 0.8 } },
|
||||
{ 1, "Track memory 2", { 0.5, 1.0, 0.5 }, "MB", 64, 1048576 },
|
||||
{ 1, "Track memory 2:C++", { 0.2, 0.2, 1.0 } },
|
||||
{ 1, "Track memory 2:Interpreter", { 0.8, 0.2, 0.5 } },
|
||||
{ 1, "Vertex Data", { 1.0, 0.4, 0.0 }, "MB", 64, 1048576 },
|
||||
{ 1, "Vertex Data:Independent", { 0.9, 0.1, 0.9 } },
|
||||
{ 1, "Vertex Data:Small", { 0.2, 0.3, 0.4 } },
|
||||
|
Loading…
x
Reference in New Issue
Block a user