Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
block_manager Class Reference

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

- Static Public Member Functions inherited from singleton< block_manager >
static instance_pointer get_instance ()
 
static instance_typeget_ref ()
 

Constructor & Destructor Documentation

Member Function Documentation

uint64_t current_allocation ( ) const

return currently allocated bytes

Definition at line 128 of file block_manager.cpp.

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

uint64_t free_bytes ( ) const

Return total number of free bytes.

Definition at line 110 of file block_manager.cpp.

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

uint64_t maximum_allocation ( ) const

return maximum number of bytes allocated during program run.

Definition at line 134 of file block_manager.cpp.

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

Referenced by Context::Launch().

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::new_blocks().

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

uint64_t total_allocation ( ) const

return total requested allocation in bytes

Definition at line 122 of file block_manager.cpp.

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

uint64_t total_bytes ( ) const

return total number of bytes available in all disks

Definition at line 98 of file block_manager.cpp.

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

Member Data Documentation

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().

constexpr bool debug = false
staticprivate

Definition at line 56 of file block_manager.hpp.

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().

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().

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: