lab_Unix/L3/lesson_code/09-test-wait-2.c
/* Keep CPU busy for a time proportional to loops, Hard to be
   optimized by compilers */
Keep CPU busy for a time proportional to loops, Hard to be
optimized by compilers
Keep CPU busy for a time proportional to loops Hard to be optimized by compilers
void busy_cpu(unsigned long loops) {
	int i;    
	double my_var=0.25;
	for(i=0; i<loops; i++){
		my_var += 0.5;
		my_var = my_var > 1 ? my_var-1 : my_var;
	}
}
void busy_cpu ( unsigned long loops ) { int i ; double my_var = 0.25 ; for ( i = 0 ; i < loops ; i ++ ) { my_var += 0.5 ; my_var = my_var > 1 ? my_var - 1 : my_var ; } }
Keep CPU busy for a time proportional to loops, Hard to be
optimized by compilers
Keep CPU busy for a time proportional to loops Hard to be optimized by compilers
/* Different than global variable */