find c++ execution time

后端 未结 6 1856
难免孤独
难免孤独 2021-01-13 09:34

I am curious if there is a build-in function in C++ for measuring the execution time? I am using Windows at the moment. In Linux it\'s pretty easy...

6条回答
  •  甜味超标
    2021-01-13 10:11

    You can use the Windows API Function GetTickCount() and compare the values at start and end. Resolution is in the 16 ms ballpark. If for some reason you need more fine-grained timings, you'll need to look at QueryPerformanceCounter.

提交回复
热议问题