40 return _pending_ram_class;
53 if (_ram_class != RC_resident) {
54 request_ram_class(RC_resident);
70 return do_alloc(size);
104 nassertr(rclass >= 0 && rclass < RC_end_of_list, NULL);
105 return _global_lru[rclass];
117 return &_pending_lru;
146 return do_save_to_disk();
162 if (_thread_mgr == (PageThreadManager *)NULL) {
165 return _thread_mgr->get_num_threads();
177 if (_thread_mgr == (PageThreadManager *)NULL) {
180 return _thread_mgr->get_num_pending_reads();
192 if (_thread_mgr == (PageThreadManager *)NULL) {
195 return _thread_mgr->get_num_pending_writes();
212 if (_ram_class != RC_resident || _pending_ram_class != RC_resident) {
216 request_ram_class(RC_resident);
217 if (_ram_class != RC_resident) {
224 nassertr(_size == _uncompressed_size, _page_data);
239 if (_book_size != other._book_size) {
240 return _book_size < other._book_size;
245 return this < &other;
254 INLINE
void VertexDataPage::
255 set_ram_class(RamClass rclass) {
270 INLINE
size_t VertexDataPage::
271 round_up(
size_t page_size)
const {
272 return ((page_size + _block_size - 1) / _block_size) * _block_size;
An implementation of a very simple LRU algorithm.
A block of bytes that holds one or more VertexDataBlocks.
A temporary file to hold the vertex data that has been evicted from memory and written to disk...
VertexDataBook * get_book() const
Returns a pointer to the book that owns this page.
RamClass get_ram_class() const
Returns the current ram class of the array.
static VertexDataSaveFile * get_save_file()
Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when nece...
SimpleAllocatorBlock * get_first_block() const
Returns a pointer to the first allocated block, or NULL if there are no allocated blocks...
RamClass get_pending_ram_class() const
Returns the pending ram class of the array.
void mark_used_lru() const
To be called when the page is used; this will move it to the tail of the SimpleLru queue it is alread...
static int get_num_pending_reads()
Returns the number of read requests that are waiting to be serviced by a thread.
void request_resident()
Ensures that the page will become resident soon.
A lightweight C++ object whose constructor calls acquire() and whose destructor calls release() on a ...
static SimpleLru * get_global_lru(RamClass rclass)
Returns a pointer to the global LRU object that manages the VertexDataPage's with the indicated RamCl...
A block of bytes that stores the actual raw vertex data referenced by a GeomVertexArrayData object...
bool operator<(const VertexDataPage &other) const
This comparison method is used to order pages within a book.
static SimpleLru * get_pending_lru()
Returns a pointer to the global LRU object that manages the VertexDataPage's that are pending process...
bool save_to_disk()
Writes the page to disk, but does not evict it from memory or affect its LRU status.
A collection of VertexDataPages, which can be used to allocate new VertexDataBlock objects...
static int get_num_pending_writes()
Returns the number of write requests that are waiting to be serviced by a thread. ...
VertexDataBlock * alloc(size_t size)
Allocates a new block.
unsigned char * get_page_data(bool force)
Returns a pointer to the page's data area, or NULL if the page is not currently resident.
VertexDataBlock * get_first_block() const
Returns a pointer to the first allocated block, or NULL if there are no allocated blocks...
static int get_num_threads()
Returns the number of threads that have been spawned to service vertex paging requests, or 0 if no threads have been spawned (which may mean either that all paging requests will be handled by the main thread, or simply that no paging requests have yet been issued).