21 lines
402 B
C
21 lines
402 B
C
#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;
|
|
} |