1: // GetTickCount accuracy is about 10~15ms
2: DWORD start = GetTickCount();
3: PRINT("Time used for :%ld ms ", GetTickCount() - start);
4:
5: // If need higher accuracy
6: LARGE_INTEGER lp_s, lp_e, lp;
7: QueryPerformanceCounter(&lp_s);
8: // measured function here ...
9: QueryPerformanceCounter(&lp_e);
10: QueryPerformanceFrequency(&lp);
11: PRINT("Time used for func :%I64d ticks ", lp_e.QuadPart - lp_s.QuadPart);
12: PRINT("Time used for func :%f sec ", (float)(lp_e.QuadPart - lp_s.QuadPart) / (float)lp.QuadPart);
No comments:
Post a Comment