gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 13:54:02 26 4
gpt4 key购买 nike

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

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

最佳答案

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

有关使用这些 API 进行代码计时的 MSDN 文章 here (示例代码在 VB 中 - 抱歉)。

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

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