arm linux 精准计算程序运行时间

#include

#include

 

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

你可能感兴趣的:(经验分享)