/usr/include/stxxl/bits/mng
NameSizeModeActions
adaptor.h238880644editdlrm
bid.h42930644editdlrm
block_alloc.h60510644editdlrm
block_alloc_interleaved.h42150644editdlrm
block_manager.h88930644editdlrm
block_prefetcher.h79410644editdlrm
block_scheduler.h782200644editdlrm
buf_istream.h45800644editdlrm
buf_istream_reverse.h52720644editdlrm
buf_ostream.h37700644editdlrm
buf_writer.h74030644editdlrm
config.h79600644editdlrm
disk_allocator.h71030644editdlrm
prefetch_pool.h101800644editdlrm
read_write_pool.h53030644editdlrm
typed_block.h116120644editdlrm
write_pool.h93730644editdlrm
Edit: /usr/include/stxxl/bits/mng/block_alloc_interleaved.h (4215B)
/*************************************************************************** * include/stxxl/bits/mng/block_alloc_interleaved.h * * Part of the STXXL. See http://stxxl.sourceforge.net * * Copyright (C) 2002, 2003 Roman Dementiev * Copyright (C) 2007-2009, 2011 Andreas Beckmann * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) **************************************************************************/ #ifndef STXXL_MNG_BLOCK_ALLOC_INTERLEAVED_HEADER #define STXXL_MNG_BLOCK_ALLOC_INTERLEAVED_HEADER #include #include #include STXXL_BEGIN_NAMESPACE #define CHECK_RUN_BOUNDS(pos) struct interleaved_striping { protected: int_type nruns; unsigned_type begindisk; unsigned_type diff; interleaved_striping(int_type nruns, unsigned_type begindisk, unsigned_type diff) : nruns(nruns), begindisk(begindisk), diff(diff) { } public: interleaved_striping(int_type _nruns, const striping& strategy) : nruns(_nruns), begindisk(strategy.begin), diff(strategy.diff) { } unsigned_type operator () (unsigned_type i) const { return begindisk + (i / nruns) % diff; } }; struct interleaved_FR : public interleaved_striping { typedef random_number rnd_type; rnd_type rnd; interleaved_FR(int_type _nruns, const FR& strategy) : interleaved_striping(_nruns, strategy.begin, strategy.diff) { } unsigned_type operator () (unsigned_type /*i*/) const { return begindisk + rnd(rnd_type::value_type(diff)); } }; struct interleaved_SR : public interleaved_striping { typedef random_number rnd_type; std::vector offsets; interleaved_SR(int_type _nruns, const SR& strategy) : interleaved_striping(_nruns, strategy.begin, strategy.diff) { rnd_type rnd; for (int_type i = 0; i < nruns; i++) offsets.push_back(rnd(rnd_type::value_type(diff))); } unsigned_type operator () (unsigned_type i) const { return begindisk + (i / nruns + offsets[i % nruns]) % diff; } }; struct interleaved_RC : public interleaved_striping { std::vector > perms; interleaved_RC(int_type _nruns, const RC& strategy) : interleaved_striping(_nruns, strategy.begin, strategy.diff), perms(nruns, std::vector(diff)) { for (int_type i = 0; i < nruns; i++) { for (unsigned_type j = 0; j < diff; j++) perms[i][j] = j; random_number rnd; std::random_shuffle(perms[i].begin(), perms[i].end(), rnd _STXXL_FORCE_SEQUENTIAL); } } unsigned_type operator () (unsigned_type i) const { return begindisk + perms[i % nruns][(i / nruns) % diff]; } }; struct first_disk_only : public interleaved_striping { first_disk_only(int_type _nruns, const single_disk& strategy) : interleaved_striping(_nruns, strategy.disk, 1) { } unsigned_type operator () (unsigned_type) const { return begindisk; } }; template struct interleaved_alloc_traits { }; template <> struct interleaved_alloc_traits { typedef interleaved_striping strategy; }; template <> struct interleaved_alloc_traits { typedef interleaved_FR strategy; }; template <> struct interleaved_alloc_traits { typedef interleaved_SR strategy; }; template <> struct interleaved_alloc_traits { typedef interleaved_RC strategy; }; template <> struct interleaved_alloc_traits { // FIXME! HACK! typedef interleaved_RC strategy; }; template <> struct interleaved_alloc_traits { // FIXME! HACK! typedef interleaved_RC strategy; }; template <> struct interleaved_alloc_traits { typedef first_disk_only strategy; }; STXXL_END_NAMESPACE #endif // !STXXL_MNG_BLOCK_ALLOC_INTERLEAVED_HEADER // vim: et:ts=4:sw=4