Posted on 2006-08-09 18:44
五指魅力 阅读(219)
评论(0) 编辑 收藏 引用
DWORD dwStart = GetTickCount();
// 测试代码
.
.
.
DWORD dwTime = GetTickCount() - dwStart;
dwTime 就是代码的运行时间了,单位是毫秒。
方法二:
LARGE_INTEGER start,end,freq;
QueryPerformanceFrequency(&freq);
QueryPerformanceCounter(&start);
// function called here
QueryPerformanceCounter(&end);
printf("function call time:%.6f seconds\n",(end.QuadPart-start.QuadPart)/(freq.QuadPart+0.0f));