libfoedus-core
FOEDUS Core Library
foedus::memory::PagePoolOffsetChunk Class Reference

To reduce the overhead of grabbing/releasing pages from pool, we pack this many pointers for each grab/release. More...

Detailed Description

To reduce the overhead of grabbing/releasing pages from pool, we pack this many pointers for each grab/release.

The pointers themselves might not be contiguous. This is just a package of pointers.

Definition at line 47 of file page_pool.hpp.

#include <page_pool.hpp>

Public Types

enum  Constants { kMaxSize = (1 << 12) - 1 }
 

Public Member Functions

 PagePoolOffsetChunk ()
 
uint32_t capacity () const
 
uint32_t size () const
 
bool empty () const
 
bool full () const
 
void clear ()
 
PagePoolOffset pop_back ()
 
void push_back (PagePoolOffset pointer)
 
void push_back (const PagePoolOffset *begin, const PagePoolOffset *end)
 
void move_to (PagePoolOffset *destination, uint32_t count)
 

Member Enumeration Documentation

Enumerator
kMaxSize 

Max number of pointers to pack.

-1 for size_ (make the size of this class power of two).

Definition at line 49 of file page_pool.hpp.

49  {
54  kMaxSize = (1 << 12) - 1,
55  };
Max number of pointers to pack.
Definition: page_pool.hpp:54

Constructor & Destructor Documentation

foedus::memory::PagePoolOffsetChunk::PagePoolOffsetChunk ( )
inline

Definition at line 56 of file page_pool.hpp.

56 : size_(0) {}

Member Function Documentation

uint32_t foedus::memory::PagePoolOffsetChunk::capacity ( ) const
inline

Definition at line 58 of file page_pool.hpp.

References kMaxSize.

Referenced by foedus::memory::PagePoolPimpl::grab(), foedus::memory::RoundRobinPageGrabBatch::grab(), and foedus::memory::DivvyupPageGrabBatch::grab().

58 { return kMaxSize; }
Max number of pointers to pack.
Definition: page_pool.hpp:54

Here is the caller graph for this function:

void foedus::memory::PagePoolOffsetChunk::clear ( )
inline

Definition at line 62 of file page_pool.hpp.

Referenced by foedus::snapshot::SnapshotManagerPimpl::drop_volatile_pages(), and foedus::snapshot::SnapshotManagerPimpl::drop_volatile_pages_parallel().

62 { size_ = 0; }

Here is the caller graph for this function:

void foedus::memory::PagePoolOffsetChunk::move_to ( PagePoolOffset destination,
uint32_t  count 
)

Definition at line 40 of file page_pool.cpp.

References ASSERT_ND.

40  {
41  ASSERT_ND(size_ >= count);
42  std::memcpy(destination, chunk_ + (size_ - count), count * sizeof(PagePoolOffset));
43  // we move from the tail of this chunk. so, just decrementing the count is enough.
44  // no need to move the remainings back to the beginning
45  size_ -= count;
46 }
uint32_t PagePoolOffset
Offset in PagePool that compactly represents the page address (unlike 8 bytes pointer).
Definition: memory_id.hpp:44
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72
PagePoolOffset foedus::memory::PagePoolOffsetChunk::pop_back ( )
inline

Definition at line 64 of file page_pool.hpp.

References ASSERT_ND, and empty().

Referenced by foedus::memory::RoundRobinPageGrabBatch::grab(), foedus::memory::NumaCoreMemory::grab_free_snapshot_page(), and foedus::memory::NumaCoreMemory::grab_free_volatile_page().

64  {
65  ASSERT_ND(!empty());
66  return chunk_[--size_];
67  }
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::memory::PagePoolOffsetChunk::push_back ( PagePoolOffset  pointer)
inline

Definition at line 68 of file page_pool.hpp.

References ASSERT_ND, and full().

Referenced by foedus::storage::sequential::SequentialStoragePimpl::drop(), foedus::storage::Composer::DropVolatilesArguments::drop(), foedus::memory::PagePoolPimpl::grab(), foedus::memory::PageReleaseBatch::release(), foedus::memory::NumaCoreMemory::release_free_snapshot_page(), and foedus::memory::NumaCoreMemory::release_free_volatile_page().

68  {
69  ASSERT_ND(!full());
70  chunk_[size_++] = pointer;
71  }
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::memory::PagePoolOffsetChunk::push_back ( const PagePoolOffset begin,
const PagePoolOffset end 
)

Definition at line 34 of file page_pool.cpp.

References ASSERT_ND, and kMaxSize.

34  {
35  uint32_t count = end - begin;
36  ASSERT_ND(size_ + count <= kMaxSize);
37  std::memcpy(chunk_ + size_, begin, count * sizeof(PagePoolOffset));
38  size_ += count;
39 }
uint32_t PagePoolOffset
Offset in PagePool that compactly represents the page address (unlike 8 bytes pointer).
Definition: memory_id.hpp:44
Max number of pointers to pack.
Definition: page_pool.hpp:54
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

The documentation for this class was generated from the following files: