做算法,难免想知道自己设计的算法的 速度,给大家介绍一个非常准确的计时函数,具体使用见下面例子
LARGE_INTEGER liFrequency;
LARGE_INTEGER liStart;
LARGE_INTEGER liEnd;
QueryPerformanceFrequency(&liFrequency);
QueryPerformanceCounter(&liStart);
//do........
QueryPerformanceCounter(&liEnd);
double dTime = 1000 * 1.0 / liFrequency.QuadPart * (liEnd.QuadPart - liStart.QuadPart);
听说CPU 1G 精确度 大约为 1/1000,000,000 秒,怎么样,够用了吧