16 return new Unit(
false );
25 if (temp < RAND_MAX/400) {
27 }
else if (temp < RAND_MAX/102) {
30 }
else if (temp < RAND_MAX/90) {
40 srand( time( NULL ) );
46 seconds = time( NULL );
47 for (
int i = 0;
i < (SIZE/2); ++
i)
49 seconds = time( NULL )-seconds;
50 printf(
"constructed list of size : %d in %d seconds using prepend\n", SIZE/2, seconds );
51 printf(
"Randomnly inserting %d \n", SIZE/2 );
53 seconds = time( NULL );
57 if (rnd < RAND_MAX/200) {
58 iter.postinsert( u[ii] );
60 }
else if (rnd < RAND_MAX/100) {
61 iter.preinsert( u[ii] );
65 seconds = time( NULL )-seconds;
66 printf(
".... took %d seconds \n", seconds );
67 for (
int i = 0; i < SIZE/32; ++i)
68 if (rand() < RAND_MAX/20)
70 printf(
"randomly killed SIZE/32 to start off with \n" );
72 printf(
"beginning unitCollection removal/advance operations\n" );
73 seconds = time( NULL );
76 while ( !c->
empty() ) {
86 seconds = time( NULL )-seconds;
87 printf(
"operations took %d seconds \n", seconds );
88 levels = levels/passes;
89 printf(
"Average number of concurrent iterators %d\n", levels );
90 printf(
"verifying destruction of units\n" );
91 for (
unsigned int i = 0;
i <
SIZE;
i++) {
92 if (u[i]->zapped != u[i]->killed)
93 printf(
"Unit at %d is zapped %d killed %d\n", i, u[i]->zapped, u[i]->killed );
98 for (
un_iter counter =
c->createIterator(); counter.notDone(); ++counter)
100 printf(
"size of list is verified at %d : %d killed \n", size, SIZE-size );
102 printf(
"completed\n" );