Panda3D
|
One atomic piece that may be managed by a AdaptiveLru chain. More...
#include "adaptiveLru.h"
Public Member Functions | |
AdaptiveLruPage (size_t lru_size) | |
AdaptiveLruPage (const AdaptiveLruPage ©) | |
void | dequeue_lru () |
Removes the page from its AdaptiveLru. | |
void | enqueue_lru (AdaptiveLru *lru) |
Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added. | |
virtual void | evict_lru () |
Evicts the page from the LRU. | |
AdaptiveLru * | get_lru () const |
Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU. | |
size_t | get_lru_size () const |
Returns the size of this page as reported to the LRU, presumably in bytes. | |
unsigned int | get_num_frames () const |
Returns the number of frames since the page was first added to its LRU. | |
unsigned int | get_num_inactive_frames () const |
Returns the number of frames since the page was last accessed on its LRU. | |
void | mark_used_lru () const |
To be called when the page is used; this will move it to the tail of the AdaptiveLru queue it is already on. | |
void | mark_used_lru (AdaptiveLru *lru) |
To be called when the page is used; this will move it to the tail of the specified AdaptiveLru queue. | |
void | operator= (const AdaptiveLruPage ©) |
virtual void | output (ostream &out) const |
void | set_lru_size (size_t lru_size) |
Specifies the size of this page, presumably in bytes, although any unit is possible. | |
virtual void | write (ostream &out, int indent_level) const |
Friends | |
class | AdaptiveLru |
One atomic piece that may be managed by a AdaptiveLru chain.
To use this class, inherit from it and override evict_lru().
This class multiply inherits from two classes which in turn both inherit from LinkedListNode. This is just a sneaky C++ trick to allow this class to inherit from LinkedListNode twice, so that pages can be stored on two different linked lists simultaneously. The AdaptiveLru class depends on this; it maintains its pages in two different lists, one grouped by priority, and one in order by next partial update needs.
Definition at line 145 of file adaptiveLru.h.
void AdaptiveLruPage::dequeue_lru | ( | ) | [inline] |
Removes the page from its AdaptiveLru.
Definition at line 171 of file adaptiveLru.I.
References enqueue_lru().
Referenced by DXTextureContext8::evict_lru(), DXIndexBufferContext8::evict_lru(), DXIndexBufferContext9::evict_lru(), DXVertexBufferContext8::evict_lru(), DXTextureContext9::evict_lru(), TinyTextureContext::evict_lru(), evict_lru(), and TinyGraphicsStateGuardian::release_texture().
void AdaptiveLruPage::enqueue_lru | ( | AdaptiveLru * | lru | ) |
Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added.
If lru is NULL, it means to remove this page from its LRU.
Definition at line 182 of file adaptiveLru.cxx.
References AdaptiveLru::do_access_page(), AdaptiveLru::do_add_page(), and AdaptiveLru::do_remove_page().
Referenced by DXGraphicsStateGuardian8::apply_index_buffer(), DXGraphicsStateGuardian9::apply_index_buffer(), DXGraphicsStateGuardian8::apply_vertex_buffer(), dequeue_lru(), TinyGraphicsStateGuardian::framebuffer_copy_to_texture(), DXGraphicsStateGuardian8::framebuffer_copy_to_texture(), DXGraphicsStateGuardian9::framebuffer_copy_to_texture(), mark_used_lru(), DXGraphicsStateGuardian8::update_texture(), DXGraphicsStateGuardian9::update_texture(), and TinyGraphicsStateGuardian::update_texture().
void AdaptiveLruPage::evict_lru | ( | ) | [virtual] |
Evicts the page from the LRU.
Called internally when the LRU determines that it is full. May also be called externally when necessary to explicitly evict the page.
It is legal for this method to either evict the page as requested, do nothing (in which case the eviction will be requested again at the next epoch), or requeue itself on the tail of the queue (in which case the eviction will be requested again much later).
Reimplemented in TinyTextureContext, DXTextureContext9, DXIndexBufferContext8, DXVertexBufferContext8, DXIndexBufferContext9, and DXTextureContext8.
Definition at line 557 of file adaptiveLru.cxx.
References dequeue_lru().
Referenced by AdaptiveLru::do_evict_to().
AdaptiveLru * AdaptiveLruPage::get_lru | ( | ) | const [inline] |
Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU.
Definition at line 161 of file adaptiveLru.I.
size_t AdaptiveLruPage::get_lru_size | ( | ) | const [inline] |
Returns the size of this page as reported to the LRU, presumably in bytes.
Definition at line 209 of file adaptiveLru.I.
unsigned int AdaptiveLruPage::get_num_frames | ( | ) | const |
Returns the number of frames since the page was first added to its LRU.
Returns 0 if it does not have an LRU.
Definition at line 589 of file adaptiveLru.cxx.
unsigned int AdaptiveLruPage::get_num_inactive_frames | ( | ) | const |
Returns the number of frames since the page was last accessed on its LRU.
Returns 0 if it does not have an LRU.
Definition at line 604 of file adaptiveLru.cxx.
void AdaptiveLruPage::mark_used_lru | ( | ) | const [inline] |
To be called when the page is used; this will move it to the tail of the AdaptiveLru queue it is already on.
This method is const because it's not technically modifying the contents of the page itself.
Definition at line 185 of file adaptiveLru.I.
Referenced by DXTextureContext8::evict_lru(), and DXTextureContext9::evict_lru().
void AdaptiveLruPage::mark_used_lru | ( | AdaptiveLru * | lru | ) | [inline] |
To be called when the page is used; this will move it to the tail of the specified AdaptiveLru queue.
Definition at line 198 of file adaptiveLru.I.
References enqueue_lru().
void AdaptiveLruPage::set_lru_size | ( | size_t | lru_size | ) | [inline] |
Specifies the size of this page, presumably in bytes, although any unit is possible.
Definition at line 220 of file adaptiveLru.I.
Referenced by IndexBufferContext::update_data_size_bytes(), VertexBufferContext::update_data_size_bytes(), and TextureContext::update_data_size_bytes().