15 #include "geomCacheEntry.h" 16 #include "geomCacheManager.h" 17 #include "lightMutexHolder.h" 18 #include "config_gobj.h" 19 #include "clockObject.h" 39 record(
Thread *current_thread) {
46 if (gobj_cat.is_debug()) {
48 <<
"recording cache entry: " << *
this <<
", total_size = " 49 << cache_mgr->_total_size + 1 <<
"\n";
52 insert_before(cache_mgr->_list);
53 ++cache_mgr->_total_size;
54 cache_mgr->_geom_cache_size_pcollector.set_level(cache_mgr->_total_size);
55 cache_mgr->_geom_cache_record_pcollector.add_level(1);
59 GeomCacheManager::_geom_cache_active_pcollector.add_level(1);
88 insert_before(cache_mgr->_list);
92 if (_last_frame_used != current_frame) {
93 GeomCacheManager::_geom_cache_active_pcollector.add_level(1);
97 _last_frame_used = current_frame;
113 if (gobj_cat.is_debug()) {
115 <<
"remove_entry(" << *
this <<
")\n";
122 --cache_mgr->_total_size;
123 cache_mgr->_geom_cache_size_pcollector.set_level(cache_mgr->_total_size);
124 cache_mgr->_geom_cache_erase_pcollector.add_level(1);
128 if (_last_frame_used == current_frame) {
129 GeomCacheManager::_geom_cache_active_pcollector.sub_level(1);
151 void GeomCacheEntry::
152 output(ostream &out)
const {
153 out <<
"[ unknown ]";
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
int get_frame_count(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of times tick() has been called since the ClockObject was created, or since it was last reset.
Similar to MutexHolder, but for a light mutex.
This is used to keep track of, and limit the size of, the cache of munged vertices, which would otherwise be distributed through all of the GeomVertexData objects in the system.
virtual void evict_callback()
Called when the entry is evicted from the cache, this should clean up the owning object appropriately...
void ref() const
Explicitly increments the reference count.
void refresh(Thread *current_thread)
Marks the cache entry recently used, so it will not be evicted for a while.
void evict_old_entries()
Trims the cache size down to get_max_size() by evicting old cache entries as needed.
A thread; that is, a lightweight process.
static bool is_connected()
Returns true if the client believes it is connected to a working PStatServer, false otherwise...
This object contains a single cache entry in the GeomCacheManager.
TypeHandle is the identifier used to differentiate C++ class types.
static GeomCacheManager * get_global_ptr()
Returns the global cache manager pointer.
virtual bool unref() const
Explicitly decrements the reference count.