[go: up one dir, main page]

Menu

[8bf46b]: / algo / test_asch.cpp  Maximize  Restore  History

Download this file

42 lines (33 with data), 790 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "async_schedule.h"
#include "../common/rand.h"
#include <stdlib.h>
int main(int argc, char * argv[])
{
if(argc < 5)
{
STXXL_ERRMSG("Usage: "<<argv[0]<<" D L m seed")
return -1;
}
int i;
const int D = atoi(argv[1]);
const int L = atoi(argv[2]);
const int m = atoi(argv[3]);
stxxl::ran32State = atoi(argv[4]);
int * disks = new int [L];
int * prefetch_order = new int [L];
int * count = new int [D];
for(i=0;i<D;i++)
count[i] = 0;
stxxl::random_number<> rnd;
for(i=0;i<L;i++)
{
disks[i] = rnd(D);
count[disks[i]]++;
}
for(i=0;i<D;i++)
std::cout << "Disk "<<i<<" has "<<count[i]<<" blocks"<<std::endl;
stxxl::compute_prefetch_schedule(disks,disks + L,prefetch_order,m,D);
delete [] count;
delete [] disks;
delete [] prefetch_order;
}