14 #ifndef STXXL_MNG__BLOCK_ALLOC_H 
   15 #define STXXL_MNG__BLOCK_ALLOC_H 
   18 #include <stxxl/bits/parallel.h> 
   19 #include <stxxl/bits/common/rand.h> 
   20 #include <stxxl/bits/mng/config.h> 
   23 __STXXL_BEGIN_NAMESPACE
 
   37     int operator () (
int i) 
const;
 
   38     static const char * name();
 
   48     striping(
int b, 
int e) : begin(b), diff(e - b)
 
   53         diff = config::get_instance()->disks_number();
 
   56     int operator () (
int i)
 const 
   58         return begin + i % diff;
 
   61     static const char * name()
 
   81     int operator () (
int )
 const 
   83         return begin + rnd(diff);
 
   86     static const char * name()
 
   88         return "fully randomized striping";
 
  116     int operator () (
int i)
 const 
  118         return begin + (i + offset) % diff;
 
  121     static const char * name()
 
  123         return "simple randomized striping";
 
  132     std::vector<int> perm;
 
  136         for (
int i = 0; i < diff; i++)
 
  139         stxxl::random_number<random_uniform_fast> rnd;
 
  154     int operator () (
int i)
 const 
  156         return begin + perm[i % diff];
 
  159     static const char * name()
 
  161         return "randomized cycling striping";
 
  165 struct RC_disk : 
public RC 
  167     RC_disk(
int b, 
int e) : 
RC(b, e)
 
  170     RC_disk() : 
RC(
config::get_instance()->regular_disk_range().first, 
config::get_instance()->regular_disk_range().second)
 
  173     static const char * name()
 
  175         return "Randomized cycling striping on regular disks";
 
  179 struct RC_flash : 
public RC 
  181     RC_flash(
int b, 
int e) : 
RC(b, e)
 
  184     RC_flash() : 
RC(
config::get_instance()->flash_range().first, 
config::get_instance()->flash_range().second)
 
  187     static const char * name()
 
  189         return "Randomized cycling striping on flash devices";
 
  204     int operator () (
int )
 const 
  209     static const char * name()
 
  211         return "single disk";
 
  218 template <
class BaseAllocator_>
 
  228     offset_allocator(int_type offset_, 
const BaseAllocator_ & base_) : base(base_), offset(offset_)
 
  240     int operator () (int_type i)
 const 
  242         return base(offset + i);
 
  245     int_type get_offset()
 const 
  250     void set_offset(int_type i)
 
  256 #ifndef STXXL_DEFAULT_ALLOC_STRATEGY 
  257     #define STXXL_DEFAULT_ALLOC_STRATEGY stxxl::RC 
  262 __STXXL_END_NAMESPACE
 
  264 #endif // !STXXL_MNG__BLOCK_ALLOC_H 
fully randomized disk allocation scheme functor 
Definition: block_alloc.h:69
 
striping disk allocation scheme functor 
Definition: block_alloc.h:43
 
offset_allocator(const BaseAllocator_ &base_)
Creates functor based on instance of BaseAllocator_ functor. 
Definition: block_alloc.h:233
 
example disk allocation scheme functor 
Definition: block_alloc.h:33
 
void random_shuffle(ExtIterator_ first, ExtIterator_ last, RandomNumberGenerator_ &rand, unsigned_type M, AllocStrategy_ AS=STXXL_DEFAULT_ALLOC_STRATEGY())
External equivalent of std::random_shuffle. 
Definition: random_shuffle.h:49
 
offset_allocator(int_type offset_, const BaseAllocator_ &base_)
Creates functor based on instance of BaseAllocator_ functor with offset offset_. 
Definition: block_alloc.h:228
 
simple randomized disk allocation scheme functor 
Definition: block_alloc.h:94
 
Allocator functor adaptor. 
Definition: block_alloc.h:219
 
'single disk' disk allocation scheme functor 
Definition: block_alloc.h:195
 
offset_allocator()
Creates functor based on default BaseAllocator_ functor. 
Definition: block_alloc.h:237
 
Access point to disks properties. 
Definition: config.h:31
 
randomized cycling disk allocation scheme functor 
Definition: block_alloc.h:129