Exemplo n.º 1
0
main()
{
	int sum;
	int i;
	int j;
	sum = 0;


	for (i = 0; i < 50; i++){
		for (j = 0; j < 50; j++){
			arrayA[i][j] = array[j];
		}
	}

	int k;
	int rand1;
	int rand2;
	irand_init();

	for (k = 0; k < 900; k++){			//in total 180 000 references
		for (i = 0; i < 50; i++){
				rand1 = irand(0, 50);	//random number 0-49,to guarantee the comparison
				rand2 = irand(0, 50);	//random number 0-49,to guarantee the comparison
				sum += arrayA[i][1];	// choose element 1 and 35 to make sure they are on different pages, since every page is 128 contenting 32 integers
				sum += arrayA[i][35];	
				sum += arrayA[1][1];	//frequently referenced element
				sum += arrayA[40][40];	//frequently referenced element
		}
	}

	Exit(sum);
}
Exemplo n.º 2
0
int
main (int argc, char *argv[])
{
    int i, j, k;
    worm_t worm_data, *worm = &worm_data ;

    irand_init();

    clear_screen();

    worm_init(worm);
    worm_draw(worm);

    while (1) {
        /* spin */
        for (j = 0; j < 100000; j++);
        /* next move */
        worm_advance(worm);
    }
}