C ++跨平台等效于Windows的QueryPerformanceCounter()

时间:2021-09-02 03:08:43

To measure the execution time of some portion of C++ code on Windows, I tend to use the QueryPerformanceCounter() high-resolution timer. An example of that can be found in this VCblog post on STL performance.

为了测量Windows上某些C ++代码的执行时间,我倾向于使用QueryPerformanceCounter()高分辨率计时器。这个例子可以在这篇关于STL性能的VCblog帖子中找到。

With the aim of writing cross platform C++ code, what functions/classes could I use for that same purpose?

为了编写跨平台C ++代码,我可以使用哪些函数/类来实现同样的目的?

1 个解决方案

#1


6  

Assuming a modern compiler, you're probably looking for std::chrono::high_resolution_clock

假设有一个现代编译器,你可能正在寻找std :: chrono :: high_resolution_clock

#1


6  

Assuming a modern compiler, you're probably looking for std::chrono::high_resolution_clock

假设有一个现代编译器,你可能正在寻找std :: chrono :: high_resolution_clock