A block of bytes that holds one or more VertexDataBlocks. More...
#include "vertexDataPage.h"
Public Types | |
enum | RamClass { RC_resident, RC_compressed, RC_disk, RC_end_of_list } |
Public Member Functions | |
VertexDataBlock * | alloc (size_t size) |
Allocates a new block. More... | |
VertexDataBook * | get_book () const |
Returns a pointer to the book that owns this page. More... | |
VertexDataBlock * | get_first_block () const |
Returns a pointer to the first allocated block, or NULL if there are no allocated blocks. More... | |
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. More... | |
RamClass | get_pending_ram_class () const |
Returns the pending ram class of the array. More... | |
RamClass | get_ram_class () const |
Returns the current ram class of the array. More... | |
bool | operator< (const VertexDataPage &other) const |
This comparison method is used to order pages within a book. More... | |
virtual void | output (std::ostream &out) const |
void | request_resident () |
Ensures that the page will become resident soon. More... | |
bool | save_to_disk () |
Writes the page to disk, but does not evict it from memory or affect its LRU status. More... | |
virtual void | write (std::ostream &out, int indent_level) const |
Public Member Functions inherited from SimpleAllocator | |
SimpleAllocator (size_t max_size, Mutex &lock) | |
SimpleAllocator (SimpleAllocator &&from) noexcept | |
Move constructor. More... | |
SimpleAllocatorBlock * | alloc (size_t size, size_t alignment=1) |
Allocates a new block. More... | |
size_t | get_contiguous () const |
Returns an upper-bound estimate of the size of the largest contiguous block that may be allocated. More... | |
SimpleAllocatorBlock * | get_first_block () const |
Returns a pointer to the first allocated block, or NULL if there are no allocated blocks. More... | |
size_t | get_max_size () const |
Returns the available space for allocated objects. More... | |
size_t | get_total_size () const |
Returns the total size of allocated objects. More... | |
bool | is_empty () const |
Returns true if there are no blocks allocated on this page, or false if there is at least one. More... | |
void | output (std::ostream &out) const |
void | set_max_size (size_t max_size) |
Changes the available space for allocated objects. More... | |
void | write (std::ostream &out) const |
Public Member Functions inherited from SimpleLruPage | |
SimpleLruPage (size_t lru_size) | |
SimpleLruPage (const SimpleLruPage ©) | |
void | dequeue_lru () |
Removes the page from its SimpleLru. More... | |
void | enqueue_lru (SimpleLru *lru) |
Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added. More... | |
SimpleLru * | get_lru () const |
Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU. More... | |
size_t | get_lru_size () const |
Returns the size of this page as reported to the LRU, presumably in bytes. More... | |
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 already on. More... | |
void | mark_used_lru (SimpleLru *lru) |
To be called when the page is used; this will move it to the tail of the specified SimpleLru queue. More... | |
void | operator= (const SimpleLruPage ©) |
void | set_lru_size (size_t lru_size) |
Specifies the size of this page, presumably in bytes, although any unit is possible. More... | |
Static Public Member Functions | |
static void | flush_threads () |
Waits for all of the pending thread tasks to finish before returning. More... | |
static TypeHandle | get_class_type () |
static SimpleLru * | get_global_lru (RamClass rclass) |
Returns a pointer to the global LRU object that manages the VertexDataPage's with the indicated RamClass. More... | |
static int | get_num_pending_reads () |
Returns the number of read requests that are waiting to be serviced by a thread. More... | |
static int | get_num_pending_writes () |
Returns the number of write requests that are waiting to be serviced by a thread. More... | |
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). More... | |
static SimpleLru * | get_pending_lru () |
Returns a pointer to the global LRU object that manages the VertexDataPage's that are pending processing by the thread. More... | |
static VertexDataSaveFile * | get_save_file () |
static void | init_type () |
static void | stop_threads () |
Call this to stop the paging threads, if they were started. More... | |
Public Attributes | |
get_save_file | |
Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when necessary. More... | |
Friends | |
class | PageThread |
class | VertexDataBook |
A block of bytes that holds one or more VertexDataBlocks.
The entire page may be paged out, in the form of in-memory compression or to an on-disk cache file, if necessary.
Definition at line 37 of file vertexDataPage.h.
|
inline |
Allocates a new block.
Returns NULL if a block of the requested size cannot be allocated.
To free the allocated block, call block->free(), or simply delete the block pointer.
Definition at line 55 of file vertexDataPage.I.
|
static |
Waits for all of the pending thread tasks to finish before returning.
Definition at line 190 of file vertexDataPage.cxx.
|
inline |
Returns a pointer to the book that owns this page.
Definition at line 74 of file vertexDataPage.I.
|
inline |
Returns a pointer to the first allocated block, or NULL if there are no allocated blocks.
Definition at line 65 of file vertexDataPage.I.
References SimpleAllocator::get_first_block().
|
inlinestatic |
Returns a pointer to the global LRU object that manages the VertexDataPage's with the indicated RamClass.
Definition at line 83 of file vertexDataPage.I.
Referenced by GeomVertexArrayData::lru_epoch().
|
inlinestatic |
Returns the number of read requests that are waiting to be serviced by a thread.
Definition at line 140 of file vertexDataPage.I.
|
inlinestatic |
Returns the number of write requests that are waiting to be serviced by a thread.
Definition at line 153 of file vertexDataPage.I.
|
inlinestatic |
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).
Definition at line 127 of file vertexDataPage.I.
|
inline |
Returns a pointer to the page's data area, or NULL if the page is not currently resident.
If the page is not currently resident, this will implicitly request it to become resident soon.
If force is true, this method will never return NULL, but may block until the page is available.
Definition at line 170 of file vertexDataPage.I.
References SimpleLruPage::mark_used_lru().
|
inlinestatic |
Returns a pointer to the global LRU object that manages the VertexDataPage's that are pending processing by the thread.
Definition at line 93 of file vertexDataPage.I.
|
inline |
Returns the pending ram class of the array.
If this is different from get_ram_class(), this page has been queued to be processed by the thread. Eventually the page will be set to this ram class.
Definition at line 30 of file vertexDataPage.I.
|
inline |
Returns the current ram class of the array.
If this is other than RC_resident, the array data is not resident in memory.
Definition at line 19 of file vertexDataPage.I.
|
inline |
This comparison method is used to order pages within a book.
Definition at line 192 of file vertexDataPage.I.
|
inline |
Ensures that the page will become resident soon.
Future calls to get_page_data() will eventually return non-NULL.
Definition at line 40 of file vertexDataPage.I.
|
inline |
Writes the page to disk, but does not evict it from memory or affect its LRU status.
If it gets evicted later without having been modified, it will not need to write itself to disk again.
Definition at line 115 of file vertexDataPage.I.
|
static |
Call this to stop the paging threads, if they were started.
This may block until all of the pending tasks have been completed.
Definition at line 171 of file vertexDataPage.cxx.
|
inline |
Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when necessary.
Definition at line 67 of file vertexDataPage.h.