TP-openmp/BE_OpenMP_2014/reduction/aux.c

33 lines
363 B
C
Raw Normal View History

2023-06-22 18:19:48 +00:00
#include <sys/time.h>
#include <stdlib.h>
long usecs (){
struct timeval t;
gettimeofday(&t,NULL);
return t.tv_sec*1000000+t.tv_usec;
}
void mysleep(double sec){
long s, e;
s=0; e=0;
s = usecs();
while(((double) e-s)/1000000 < sec)
{
e = usecs();
}
return;
}
void operator(int *a, int *b){
mysleep(0.01);
*a += *b;
}