Panda3D
|
An implementation of a very simple LRU algorithm. More...
#include "simpleLru.h"
Public Member Functions | |
SimpleLru (const string &name, size_t max_size) | |
void | begin_epoch () |
Marks the end of the previous epoch and the beginning of the next one. More... | |
void | consider_evict () |
Evicts a sequence of objects if the queue is full. More... | |
size_t | count_active_size () const |
Returns the total size of the pages that were enqueued since the last call to begin_epoch(). More... | |
void | evict_to (size_t target_size) |
Evicts a sequence of objects until the queue fits within the indicated target size, regardless of its normal max size. More... | |
size_t | get_max_size () const |
Returns the max size of all objects that are allowed to be active on the LRU. More... | |
size_t | get_total_size () const |
Returns the total size of all objects currently active on the LRU. More... | |
void | output (ostream &out) const |
void | set_max_size (size_t max_size) |
Changes the max size of all objects that are allowed to be active on the LRU. More... | |
bool | validate () |
Checks that the LRU is internally self-consistent. More... | |
void | write (ostream &out, int indent_level) const |
![]() | |
Namable (const string &initial_name="") | |
Namable (const Namable ©) | |
void | clear_name () |
Resets the Namable's name to empty. More... | |
const string & | get_name () const |
bool | has_name () const |
Returns true if the Namable has a nonempty name set, false if the name is empty. More... | |
Namable & | operator= (const Namable &other) |
void | output (ostream &out) const |
Outputs the Namable. More... | |
void | set_name (const string &name) |
Static Public Attributes | |
static LightMutex & | _global_lock = *new LightMutex |
Friends | |
class | SimpleLruPage |
Additional Inherited Members | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
An implementation of a very simple LRU algorithm.
Also see AdaptiveLru.
Definition at line 31 of file simpleLru.h.
|
inline |
Marks the end of the previous epoch and the beginning of the next one.
This will evict any objects that are pending eviction, and also update any internal bookkeeping.
Definition at line 94 of file simpleLru.I.
References consider_evict(), SimpleLruPage::enqueue_lru(), and validate().
Referenced by evict_to(), and GeomVertexArrayData::lru_epoch().
|
inline |
Evicts a sequence of objects if the queue is full.
Definition at line 63 of file simpleLru.I.
References evict_to().
Referenced by begin_epoch(), and set_max_size().
size_t SimpleLru::count_active_size | ( | ) | const |
Returns the total size of the pages that were enqueued since the last call to begin_epoch().
Definition at line 106 of file simpleLru.cxx.
References SimpleLruPage::evict_lru().
Referenced by SimpleLruPage::enqueue_lru().
|
inline |
Evicts a sequence of objects until the queue fits within the indicated target size, regardless of its normal max size.
Definition at line 78 of file simpleLru.I.
References begin_epoch().
Referenced by consider_evict().
|
inline |
Returns the max size of all objects that are allowed to be active on the LRU.
Definition at line 35 of file simpleLru.I.
References set_max_size().
Referenced by get_total_size().
|
inline |
Returns the total size of all objects currently active on the LRU.
Definition at line 23 of file simpleLru.I.
References get_max_size().
Referenced by GraphicsEngine::render_frame().
|
inline |
Changes the max size of all objects that are allowed to be active on the LRU.
If the size is (size_t)-1, there is no limit.
Definition at line 49 of file simpleLru.I.
References consider_evict().
Referenced by get_max_size().
|
inline |
Checks that the LRU is internally self-consistent.
Returns true if successful, false if there is some problem.
Definition at line 107 of file simpleLru.I.
References SimpleLruPage::get_lru(), and SimpleLruPage::get_lru_size().
Referenced by begin_epoch().