32 return _pending_ram_class;
42 if (_ram_class != RC_resident) {
43 request_ram_class(RC_resident);
57 return do_alloc(size);
84 nassertr(rclass >= 0 && rclass < RC_end_of_list,
nullptr);
85 return _global_lru[rclass];
103 if (_save_file ==
nullptr) {
117 return do_save_to_disk();
129 if (_thread_mgr ==
nullptr) {
132 return _thread_mgr->get_num_threads();
142 if (_thread_mgr ==
nullptr) {
145 return _thread_mgr->get_num_pending_reads();
155 if (_thread_mgr ==
nullptr) {
158 return _thread_mgr->get_num_pending_writes();
172 if (_ram_class != RC_resident || _pending_ram_class != RC_resident) {
176 request_ram_class(RC_resident);
177 if (_ram_class != RC_resident) {
184 nassertr(_size == _uncompressed_size, _page_data);
196 if (_book_size != other._book_size) {
197 return _book_size < other._book_size;
202 return this < &other;
208 INLINE
void VertexDataPage::
209 set_ram_class(RamClass rclass) {
221 INLINE
size_t VertexDataPage::
222 round_up(
size_t page_size)
const {
223 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.
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...
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_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.
VertexDataBook * get_book() const
Returns a pointer to the book that owns this page.
static SimpleLru * get_pending_lru()
Returns a pointer to the global LRU object that manages the VertexDataPage's that are pending process...
SimpleAllocatorBlock * get_first_block() const
Returns a pointer to the first allocated block, or NULL if there are no allocated blocks.
RamClass get_ram_class() const
Returns the current ram class of the array.
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.
static int get_num_threads()
Returns the number of threads that have been spawned to service vertex paging requests,...