00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef STXXL_ASYNC_SCHEDULE_HEADER
00021 #define STXXL_ASYNC_SCHEDULE_HEADER
00022
00023 #include <stxxl/bits/common/types.h>
00024
00025
00026 __STXXL_BEGIN_NAMESPACE
00027
00028 void compute_prefetch_schedule(
00029 const int_type * first,
00030 const int_type * last,
00031 int_type * out_first,
00032 int_type m,
00033 int_type D);
00034
00035 inline void compute_prefetch_schedule(
00036 int_type * first,
00037 int_type * last,
00038 int_type * out_first,
00039 int_type m,
00040 int_type D)
00041 {
00042 compute_prefetch_schedule(static_cast<const int_type *>(first), last, out_first, m, D);
00043 }
00044
00045 template <typename run_type>
00046 void compute_prefetch_schedule(
00047 const run_type & input,
00048 int_type * out_first,
00049 int_type m,
00050 int_type D)
00051 {
00052 const int_type L = input.size();
00053 int_type * disks = new int_type[L];
00054 for (int_type i = 0; i < L; ++i)
00055 disks[i] = input[i].bid.storage->get_physical_device_id();
00056 compute_prefetch_schedule(disks, disks + L, out_first, m, D);
00057 delete[] disks;
00058 }
00059
00060 template <typename bid_iterator_type>
00061 void compute_prefetch_schedule(
00062 bid_iterator_type input_begin,
00063 bid_iterator_type input_end,
00064 int_type * out_first,
00065 int_type m,
00066 int_type D)
00067 {
00068 const int_type L = input_end - input_begin;
00069 int_type * disks = new int_type[L];
00070 int_type i = 0;
00071 for (bid_iterator_type it = input_begin; it != input_end; ++it, ++i)
00072 disks[i] = it->storage->get_physical_device_id();
00073 compute_prefetch_schedule(disks, disks + L, out_first, m, D);
00074 delete[] disks;
00075 }
00076
00077 __STXXL_END_NAMESPACE
00078
00079 #endif // !STXXL_ASYNC_SCHEDULE_HEADER
00080