在C ++中用微秒的分辨率测量时间? [英] Measuring time with a resolution of microseconds in C++?
本文介绍了在C ++中用微秒的分辨率测量时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一种方法来测量microsecs在C ++ / Windows。
I'm looking for a way to measure microsecs in C++/Windows.
我读了关于clock函数,但它只返回毫秒...
有办法吗?
I read about the "clock" function, but it returns only milliseconds...
Is there a way to do it?
推荐答案
使用 QueryPerformanceCounter 和 QueryPerformanceFrequency 。
MSDN有关使用这些API的代码计时的文章这里(示例代码在VB - 对不起)。
MSDN article on code timing with these APIs here (sample code is in VB - sorry).
这篇关于在C ++中用微秒的分辨率测量时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文