Panda3D
|
An implementation of a very simple LRU algorithm. More...
#include "simpleLru.h"
Public Member Functions | |
SimpleLru (const std::string &name, size_t max_size) | |
void | begin_epoch () |
Marks the end of the previous epoch and the beginning of the next one. | |
void | consider_evict () |
Evicts a sequence of objects if the queue is full. | |
size_t | count_active_size () const |
Returns the total size of the pages that were enqueued since the last call to begin_epoch(). | |
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. | |
size_t | get_max_size () const |
Returns the max size of all objects that are allowed to be active on the LRU. | |
size_t | get_total_size () const |
Returns the total size of all objects currently active on the LRU. | |
void | output (std::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. | |
bool | validate () |
Checks that the LRU is internally self-consistent. | |
void | write (std::ostream &out, int indent_level) const |
![]() | |
Namable (const std::string &initial_name="") | |
void | clear_name () |
Resets the Namable's name to empty. | |
const std::string & | get_name () const |
bool | has_name () const |
Returns true if the Namable has a nonempty name set, false if the name is empty. | |
void | output (std::ostream &out) const |
Outputs the Namable. | |
void | set_name (const std::string &name) |
![]() | |
void | operator delete (void *, void *) |
void | operator delete (void *ptr) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
Static Public Attributes | |
static LightMutex & | _global_lock = *new LightMutex |
Friends | |
class | SimpleLruPage |
Additional Inherited Members | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
get_name | |
set_name | |
An implementation of a very simple LRU algorithm.
Also see AdaptiveLru.
Definition at line 28 of file simpleLru.h.
|
explicit |
Definition at line 28 of file simpleLru.cxx.
SimpleLru::~SimpleLru | ( | ) |
Definition at line 41 of file simpleLru.cxx.
|
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 76 of file simpleLru.I.
References consider_evict(), and SimpleLruPage::enqueue_lru().
Referenced by GeomVertexArrayData::lru_epoch().
|
inline |
Evicts a sequence of objects if the queue is full.
Definition at line 51 of file simpleLru.I.
Referenced by begin_epoch().
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 96 of file simpleLru.cxx.
|
inline |
Evicts a sequence of objects until the queue fits within the indicated target size, regardless of its normal max size.
Definition at line 63 of file simpleLru.I.
|
inline |
Returns the max size of all objects that are allowed to be active on the LRU.
Definition at line 27 of file simpleLru.I.
|
inline |
Returns the total size of all objects currently active on the LRU.
Definition at line 17 of file simpleLru.I.
Referenced by GraphicsEngine::render_frame().
void SimpleLru::output | ( | std::ostream & | out | ) | const |
Definition at line 113 of file simpleLru.cxx.
|
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 39 of file simpleLru.I.
|
inline |
Checks that the LRU is internally self-consistent.
Returns true if successful, false if there is some problem.
Definition at line 86 of file simpleLru.I.
void SimpleLru::write | ( | std::ostream & | out, |
int | indent_level ) const |
Definition at line 123 of file simpleLru.cxx.
|
friend |
Definition at line 58 of file simpleLru.h.
|
static |
Definition at line 48 of file simpleLru.h.