Thrill  0.1

Detailed Description

Block manager class.

Manages allocation and deallocation of blocks in multiple/single disk setting

Remarks
is a singleton

Definition at line 54 of file block_manager.hpp.

+ Inheritance diagram for block_manager:
+ Collaboration diagram for block_manager:

#include <block_manager.hpp>

Public Member Functions

 ~block_manager ()
 
template<size_t BlockSize>
void delete_block (const BID< BlockSize > &bid)
 
template<typename BIDIterator >
void delete_blocks (const BIDIterator &bid_begin, const BIDIterator &bid_end)
 
template<typename DiskAssignFunctor , size_t BlockSize>
void new_block (const DiskAssignFunctor &functor, BID< BlockSize > &bid, size_t alloc_offset=0)
 Allocates a new block according to the strategy given by functor and stores the block identifier to bid. More...
 
template<typename DiskAssignFunctor , typename BIDIterator >
void new_blocks (const DiskAssignFunctor &functor, BIDIterator bid_begin, BIDIterator bid_end, size_t alloc_offset=0)
 Allocates new blocks. More...
 
Statistics
uint64_t total_bytes () const
 return total number of bytes available in all disks More...
 
uint64_t free_bytes () const
 Return total number of free bytes. More...
 
uint64_t total_allocation () const
 return total requested allocation in bytes More...
 
uint64_t current_allocation () const
 return currently allocated bytes More...
 
uint64_t maximum_allocation () const
 return maximum number of bytes allocated during program run. More...
 
- Public Member Functions inherited from singleton< block_manager >
 singleton ()=default
 
 singleton (const singleton &)=delete
 non-copyable: delete copy-constructor More...
 
singletonoperator= (const singleton &)=delete
 non-copyable: delete assignment operator More...
 

Private Member Functions

 block_manager ()
 private construction from singleton More...
 

Private Attributes

tlx::simple_vector< disk_block_allocator * > block_allocators_
 one block allocator per disk More...
 
uint64_t current_allocation_ = 0
 currently allocated bytes More...
 
tlx::simple_vector< file_ptrdisk_files_
 vector of opened disk files More...
 
uint64_t maximum_allocation_ = 0
 maximum number of bytes allocated during program run. More...
 
std::mutex mutex_
 protect internal data structures More...
 
size_t ndisks_
 number of managed disks More...
 
uint64_t total_allocation_ = 0
 total requested allocation in bytes More...
 

Static Private Attributes

static constexpr bool debug = false
 
static constexpr bool verbose_block_life_cycle = false
 log creation and destruction of blocks More...
 

Additional Inherited Members

- Public Types inherited from singleton< block_manager >
using instance_pointer = instance_type *
 
using instance_type = block_manager
 
using volatile_instance_pointer = volatile instance_pointer
 
- Static Public Member Functions inherited from singleton< block_manager >
static instance_pointer create_instance ()
 create instance of SubInstanceType and move into singleton More...
 
static void destroy_instance ()
 destroy singleton and mark as invalid More...
 
static instance_pointer get_instance ()
 return instance or create base instance if empty More...
 
static instance_typeget_ref ()
 

Constructor & Destructor Documentation

◆ ~block_manager()

◆ block_manager()

Member Function Documentation

◆ current_allocation()

uint64_t current_allocation ( ) const

return currently allocated bytes

Definition at line 127 of file block_manager.cpp.

References block_manager::current_allocation_, and block_manager::mutex_.

Referenced by block_manager::new_block().

◆ free_bytes()

uint64_t free_bytes ( ) const

Return total number of free bytes.

Definition at line 109 of file block_manager.cpp.

References block_manager::block_allocators_, block_manager::mutex_, and block_manager::ndisks_.

Referenced by block_manager::new_block().

◆ maximum_allocation()

uint64_t maximum_allocation ( ) const

return maximum number of bytes allocated during program run.

Definition at line 133 of file block_manager.cpp.

References block_manager::maximum_allocation_, and block_manager::mutex_.

Referenced by Context::Launch(), and block_manager::new_block().

◆ new_block()

void new_block ( const DiskAssignFunctor &  functor,
BID< BlockSize > &  bid,
size_t  alloc_offset = 0 
)
inline

Allocates a new block according to the strategy given by functor and stores the block identifier to bid.

Allocation will be lined up with previous partial allocations of alloc_offset blocks.

Parameters
functorobject of model of allocation_strategy concept
bidBID to store the block identifier
alloc_offsetadvance for functor to line up partial allocations

Definition at line 91 of file block_manager.hpp.

References block_manager::current_allocation(), block_manager::delete_block(), block_manager::delete_blocks(), block_manager::free_bytes(), block_manager::maximum_allocation(), block_manager::new_blocks(), block_manager::total_allocation(), block_manager::total_bytes(), and block_manager::~block_manager().

Referenced by swappable_block< ValueType, BlockSize >::get_external_block().

◆ total_allocation()

uint64_t total_allocation ( ) const

return total requested allocation in bytes

Definition at line 121 of file block_manager.cpp.

References block_manager::mutex_, and block_manager::total_allocation_.

Referenced by block_manager::new_block().

◆ total_bytes()

uint64_t total_bytes ( ) const

return total number of bytes available in all disks

Definition at line 97 of file block_manager.cpp.

References block_manager::block_allocators_, block_manager::mutex_, and block_manager::ndisks_.

Referenced by block_manager::new_block().

Member Data Documentation

◆ block_allocators_

◆ current_allocation_

uint64_t current_allocation_ = 0
private

currently allocated bytes

Definition at line 149 of file block_manager.hpp.

Referenced by block_manager::current_allocation(), block_manager::delete_block(), and block_manager::new_blocks().

◆ debug

constexpr bool debug = false
staticprivate

Definition at line 56 of file block_manager.hpp.

◆ disk_files_

◆ maximum_allocation_

uint64_t maximum_allocation_ = 0
private

maximum number of bytes allocated during program run.

Definition at line 152 of file block_manager.hpp.

Referenced by block_manager::maximum_allocation(), and block_manager::new_blocks().

◆ mutex_

◆ ndisks_

◆ total_allocation_

uint64_t total_allocation_ = 0
private

total requested allocation in bytes

Definition at line 146 of file block_manager.hpp.

Referenced by block_manager::new_blocks(), and block_manager::total_allocation().

◆ verbose_block_life_cycle

constexpr bool verbose_block_life_cycle = false
staticprivate

log creation and destruction of blocks

Definition at line 161 of file block_manager.hpp.

Referenced by block_manager::delete_block(), and block_manager::new_blocks().


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