gpt4 book ai didi

c++ - 一秒钟有多少滴答声?

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

我正在使用 KeQueryPerformanceCounter获取每秒的滴答数。

我知道这是性能计数器频率,以每秒滴答数计。我不知道如何将其转换为时间单位(比如说秒、毫秒或纳秒……任何东西)?

一秒钟有多少滴答声?什么是转换系数?

LARGE_INTEGER freq;
KeQueryPerformanceCounter(&freq);

最佳答案

在链接中:

Remarks

KeQueryPerformanceCounter always returns a 64-bit integer that represents the current value of a monotonically nondecreasing counter. The counter starts incrementing from zero when the computer starts up.

To get the resolution of the timer used to accumulate the current tick count, specify a non-NULL pointer value for the PerformanceFrequency parameter. The frequency value that the routine writes to the location pointed to by this parameter is the number of ticks per second.

在这里,这意味着 freq 变量将包含每秒的滴答数

关于c++ - 一秒钟有多少滴答声?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16769464/

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