测试运行时间

LARGE_INTEGER start_PerformanceCount; QueryPerformanceCounter(&start_PerformanceCount); //起始计数器 //运行测试的代码 Sleep(1); LARGE_INTEGER end_PerformanceCount; QueryPerformanceCounter(&end_PerformanceCount); //结束计数器 LARGE_INTEGER Frequency; QueryPerformanceFrequency(&Frequency); //计数器频率 LARGE_INTEGER run_count; run_count.QuadPart = end_PerformanceCount.QuadPart - start_PerformanceCount.QuadPart;//运行时间计数器 double run_time = (double)run_count.QuadPart / (double)Frequency.QuadPart; //运行时间

你可能感兴趣的:(测试,Integer)