Developpement/23DEV1.1/TPS1/TP2/controle/Rapidite.c

21 lines
402 B
C
Raw Permalink Normal View History

2024-12-09 11:53:11 +01:00
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <sys/time.h>
int main(void)
{
struct timeval start, end;
double result;
int i;
gettimeofday(&start,NULL);
for(i = 0 ; i<1000000 ; i++){
result = sqrt(2.0);
}
gettimeofday(&end,NULL);
long elapsed_time = (end.tv_sec-start.tv_sec)*1000000+(end.tv_usec-start.tv_usec);
printf("%ldµs\n",elapsed_time);
return EXIT_SUCCESS;
}