32 block_manager::block_manager()
42 disk_files =
new file*[ndisks];
46 for (
unsigned i = 0; i < ndisks; ++i)
51 if (cfg.
queue == file::DEFAULT_QUEUE)
56 disk_files[i] =
create_file(cfg, file::CREAT | file::RDWR, i);
58 STXXL_MSG(
"Disk '" << cfg.
path <<
"' is allocated, space: " <<
59 (cfg.
size) / (1024 * 1024) <<
64 STXXL_MSG(
"Error allocating disk '" << cfg.
path <<
"', space: " <<
65 (cfg.
size) / (1024 * 1024) <<
70 total_size += cfg.
size;
77 STXXL_MSG(
"In total " << ndisks <<
" disks are allocated, space: " <<
78 (total_size / (1024 * 1024)) <<
82 #if STXXL_MNG_COUNT_ALLOCATION
83 m_current_allocation = 0;
84 m_total_allocation = 0;
85 m_maximum_allocation = 0;
86 #endif // STXXL_MNG_COUNT_ALLOCATION
89 block_manager::~block_manager()
92 for (
size_t i = ndisks; i > 0; )
95 delete disk_allocators[i];
98 delete[] disk_allocators;
102 uint64 block_manager::get_total_bytes()
const
106 for (
unsigned i = 0; i < ndisks; ++i)
107 total += disk_allocators[i]->get_total_bytes();
112 uint64 block_manager::get_free_bytes()
const
116 for (
unsigned i = 0; i < ndisks; ++i)
117 total += disk_allocators[i]->get_free_bytes();
file * create_file(const std::string &io_impl, const std::string &filename, int options, int physical_device_id=file::DEFAULT_QUEUE, int disk_allocator_id=file::NO_ALLOCATOR)
create fileio object from io_impl string and a few parameters
int queue
select request queue for disk. Use different queues for files on different disks. queue=-1 -> default...
unsigned long long int uint64
disk_config & disk(size_t disk)
Returns mutable disk_config structure for additional disk parameters.
void check_initialized()
Check that initialize() was called.
Defines interface of file.
std::string path
the file path used by the io implementation
Encapsulate the configuration of one "disk". The disk is actually a file I/O object which block_manag...
size_t disks_number()
Returns number of disks available to user.
#define STXXL_BEGIN_NAMESPACE
#define STXXL_VERBOSE1(x)
std::string fileio_string() const
return formatted fileio name and optional configuration parameters
Access point to disks properties. Since 1.4.0: no config files are read automatically! ...
uint64 size
file size to initially allocate
#define STXXL_END_NAMESPACE