LARGE_INTEGER lv;
// 獲取每秒多少CPU Performance Tick
QueryPerformanceFrequency( &lv );
// 轉換爲每個Tick多少秒
double secondsPerTick = 1.0 / lv.QuadPart;
for ( size_t i = 0; i < 100; ++i ) {
// 獲取CPU運行到現在的Tick數
QueryPerformanceCounter( &lv );
// 計算CPU運行到現在的時間
// 比GetTickCount和timeGetTime更加精確
double timeElapsedTotal = secondsPerTick * lv.QuadPart;
cout.precision( 6 );
cout << fixed << showpoint << timeElapsedTotal << endl;
//printf( "%lf /n", timeElapsedTotal ) ;
}
}