计时代码

// get micro second

   LARGE_INTEGER t1,t2,t3;

   QueryPerformanceFrequency(&t3);

   QueryPerformanceCounter(&t1);

 

// Do something

 

   QueryPerformanceCounter(&t2);

   LONGLONG quadtime = t2.QuadPart-t1.QuadPart;

   DWORD swTime = quadtime * 1000000/t3.QuadPart;

swTime即为获取的Do something的微妙时间。

 

       #include

       //*************************************************************************//
        clock_t firsttime,secondtime;
        firsttime = clock();
        //*************************************************************************//
       //此处填写需要执行的函数
        //*************************************************************************//
        secondtime = clock();
        double timetotal1 = (double)(secondtime-firsttime)/CLOCKS_PER_SEC;
        double timetotal2 = (double)(secondtime-firsttime);
        //cout<<"该函数执行时间:"<        //cout<<"该函数执行时间:"<        //*************************************************************************//

你可能感兴趣的:(软件测试,integer)