#include <stdio.h>
#include <sys/time.h>
void main()
{
struct timeval start,end;
float timeuse;
gettimeofday(&start,NULL);
/*
code .
*/
gettimeofday(&end,NULL);
timeuse=1000000*(end.tv_sec-start.tv_sec)+
end.tv_usec-start.tv_usec;
printf ("total time spend are %f s \n",timeuse/1000000);
}
// ubuntu下最好不要重复使用 不然会出现core dump