代码如下:
funcmain()
{
   ..........................
   CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)smooth1,(LPVOID)argm1,NULL,&wd[0]);
   CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)smooth2,(LPVOID)argm2,NULL,&wd[1]);
   ..................................
}
就是计算这两个线程总共的运行时间,在双核环境下运行的。
计算时间的代码:
clock_t start,end;
start=clock();
..........
end=clock();
double duration=(double)(start-end);
这段计算时间的代码应该怎么加?
谢谢大家!!

解决方案 »

  1.   

    总运行时间:max(end1, end2) - min(start1, start2).
      

  2.   

    GetThreadTimes
    The GetThreadTimes function retrieves timing information for the specified thread.BOOL GetThreadTimes(
      HANDLE hThread,             // handle to thread
      LPFILETIME lpCreationTime,  // thread creation time
      LPFILETIME lpExitTime,      // thread exit time
      LPFILETIME lpKernelTime,    // thread kernel-mode time
      LPFILETIME lpUserTime       // thread user-mode time
    );