C ++跨平台等同于Windows的QueryPerformanceCounter() [英] C++ cross-platform equivalent of Windows' QueryPerformanceCounter()
本文介绍了C ++跨平台等同于Windows的QueryPerformanceCounter()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
要测量Windows上某些部分C ++代码的执行时间,我倾向于使用 QueryPerformanceCounter()
高分辨率定时器。有关示例,请参见此VCblog帖子关于STL性能。
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.
为了编写跨平台 C ++代码,我可以使用什么函数/类来达到同样的目的?
With the aim of writing cross platform C++ code, what functions/classes could I use for that same purpose?
推荐答案
假设现代编译器,你可能需要 std :: chrono :: high_resolution_clock
Assuming a modern compiler, you're probably looking for std::chrono::high_resolution_clock
这篇关于C ++跨平台等同于Windows的QueryPerformanceCounter()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文