mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
track active cache
This commit is contained in:
parent
3b6d1fff8c
commit
90300d22d9
@ -501,6 +501,7 @@ render_frame() {
|
||||
CullTraverser::_nodes_pcollector.clear_level();
|
||||
CullTraverser::_geom_nodes_pcollector.clear_level();
|
||||
CullTraverser::_geoms_pcollector.clear_level();
|
||||
qpGeomCacheManager::_geom_cache_active_pcollector.clear_level();
|
||||
qpGeomCacheManager::_geom_cache_record_pcollector.clear_level();
|
||||
qpGeomCacheManager::_geom_cache_erase_pcollector.clear_level();
|
||||
qpGeomCacheManager::_geom_cache_evict_pcollector.clear_level();
|
||||
|
@ -57,6 +57,10 @@ record() {
|
||||
cache_mgr->_geom_cache_record_pcollector.add_level(1);
|
||||
_last_frame_used = ClockObject::get_global_clock()->get_frame_count();
|
||||
|
||||
if (PStatClient::is_connected()) {
|
||||
qpGeomCacheManager::_geom_cache_active_pcollector.add_level(1);
|
||||
}
|
||||
|
||||
// Increment our own reference count while we're in the queue, just
|
||||
// so we don't have to play games with it later--this is inner-loop
|
||||
// stuff.
|
||||
@ -86,7 +90,14 @@ refresh() {
|
||||
remove_from_list();
|
||||
insert_before(cache_mgr->_list);
|
||||
|
||||
_last_frame_used = ClockObject::get_global_clock()->get_frame_count();
|
||||
int current_frame = ClockObject::get_global_clock()->get_frame_count();
|
||||
if (PStatClient::is_connected()) {
|
||||
if (_last_frame_used != current_frame) {
|
||||
qpGeomCacheManager::_geom_cache_active_pcollector.add_level(1);
|
||||
}
|
||||
}
|
||||
|
||||
_last_frame_used = current_frame;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -115,6 +126,13 @@ erase() {
|
||||
cache_mgr->_geom_cache_size_pcollector.set_level(cache_mgr->_total_size);
|
||||
cache_mgr->_geom_cache_erase_pcollector.add_level(1);
|
||||
|
||||
if (PStatClient::is_connected()) {
|
||||
int current_frame = ClockObject::get_global_clock()->get_frame_count();
|
||||
if (_last_frame_used == current_frame) {
|
||||
qpGeomCacheManager::_geom_cache_active_pcollector.sub_level(1);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
qpGeomCacheManager *qpGeomCacheManager::_global_ptr = NULL;
|
||||
|
||||
PStatCollector qpGeomCacheManager::_geom_cache_size_pcollector("Geom cache size");
|
||||
PStatCollector qpGeomCacheManager::_geom_cache_active_pcollector("Geom cache size:Active");
|
||||
PStatCollector qpGeomCacheManager::_geom_cache_record_pcollector("Geom cache operations:record");
|
||||
PStatCollector qpGeomCacheManager::_geom_cache_erase_pcollector("Geom cache operations:erase");
|
||||
PStatCollector qpGeomCacheManager::_geom_cache_evict_pcollector("Geom cache operations:evict");
|
||||
@ -106,6 +107,12 @@ evict_old_entries() {
|
||||
|
||||
entry->evict_callback();
|
||||
|
||||
if (PStatClient::is_connected()) {
|
||||
if (entry->_last_frame_used == current_frame) {
|
||||
qpGeomCacheManager::_geom_cache_active_pcollector.sub_level(1);
|
||||
}
|
||||
}
|
||||
|
||||
--_total_size;
|
||||
entry->remove_from_list();
|
||||
_geom_cache_evict_pcollector.add_level(1);
|
||||
|
@ -87,6 +87,7 @@ private:
|
||||
|
||||
public:
|
||||
static PStatCollector _geom_cache_size_pcollector;
|
||||
static PStatCollector _geom_cache_active_pcollector;
|
||||
static PStatCollector _geom_cache_record_pcollector;
|
||||
static PStatCollector _geom_cache_erase_pcollector;
|
||||
static PStatCollector _geom_cache_evict_pcollector;
|
||||
|
@ -170,6 +170,7 @@ static LevelCollectorProperties level_properties[] = {
|
||||
{ 1, "Vertex buffer switch:Vertex", { 0.8, 0.0, 0.6 } },
|
||||
{ 1, "Vertex buffer switch:Index", { 0.8, 0.6, 0.3 } },
|
||||
{ 1, "Geom cache size", { 0.6, 0.8, 0.6 }, "", 500 },
|
||||
{ 1, "Geom cache size:Active", { 0.9, 1.0, 0.3 }, "", 500 },
|
||||
{ 1, "Geom cache operations", { 1.0, 0.6, 0.6 }, "", 500 },
|
||||
{ 1, "Geom cache operations:record", { 0.2, 0.4, 0.8 } },
|
||||
{ 1, "Geom cache operations:erase", { 0.4, 0.8, 0.2 } },
|
||||
|
Loading…
x
Reference in New Issue
Block a user