在Windows下也有像一些方便的功能,QueryPerformanceCounter从mmsystem.h创建高分辨率定时器.Linux有类似的东西吗?
我想知道一些代码块执行了多长时间.像这样的东西:
startStopwatch();
// do some calculations
stopStopwatch();
printf("%lf", timeMesuredInSeconds);
Run Code Online (Sandbox Code Playgroud)
怎么样?