gpt4 book ai didi

c++ - 在 C++ 中以微秒的分辨率测量时间?

转载 作者:行者123 更新时间:2023-11-30 17:14:11 25 4
gpt4 key购买 nike

我正在寻找一种在 C++/Windows 中测量微秒的方法。

我读到了“时钟”函数,但它只返回毫秒......
有办法做到吗?

最佳答案

使用QueryPerformanceCounterQueryPerformanceFrequency在 Windows 上实现最精细的粒度计时。

关于使用这些 API 进行代码计时的 MSDN 文章 here (示例代码是用 VB 编写的 - 抱歉)。

关于c++ - 在 C++ 中以微秒的分辨率测量时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30454819/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com