#include #include #include int main(int argc, char *argv[]) { int a[100000]; int i,sum; struct timeval start, end; gettimeofday(&start, NULL); //Your time consuming code here gettimeofday(&end, NULL); delta = ((end.tv_sec - start.tv_sec) * 1000000u + end.tv_usec - start.tv_usec) / 1.e6; printf("time=%12.10f\n",delta); }