1Tick=多少秒

Xx哼哼xX 2010-10-14 11:29:52
在测试软件性能上,为了看执行时间,我调用了GetTickCount,可是1Tick应该是多少秒呢?在网上搜了一些资料,都说1Tick=55ms,我觉得不太对吧。是不是不同的系统,这个值应该是不同的吧,我想问问Server2008上,1Tick应该是多少?
...全文
5957 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sou2012 2010-10-15
  • 打赏
  • 举报
回复
GetTickCount的精度是10-16ms

timeGetTime的精度是 1 ms 左右。
向立天 2010-10-15
  • 打赏
  • 举报
回复
QueryPerformanceFrequency可以得到
就是LARGE_INTEGER的QuadPart
计算毫秒方法是
QueryPerformanceFrequency(&litmp);//获得时钟频率
dff = (double)litmp.QuadPart;
QueryPerformanceCounter(&litmp);//获得初始值
qt1 = litmp.QuadPart;
//......
QueryPerformanceCounter(&litmp);//获得终止值
qt2 = litmp.QuadPart;
dfm = (double)(qt2-qt1);
dft = dfm*1000/dff;//获得对应的时间值
jyh_baoding 2010-10-15
  • 打赏
  • 举报
回复
根据不同的系统做差然后自己计算啊
MYNAMELIULI 2010-10-15
  • 打赏
  • 举报
回复
GetTickCount得到的是系统启动之后到现在的毫秒数
野男孩 2010-10-15
  • 打赏
  • 举报
回复
GetTickCount得到的是系统启动之后到现在的毫秒数
hilevel 2010-10-14
  • 打赏
  • 举报
回复
QueryPerformanceFrequency好像可以得到这个值

QueryPerformanceFrequency
This function retrieves the frequency, in counts per second, of the high-resolution performance counter.

BOOL QueryPerformanceFrequency (
LARGE_INTEGER *lpliFrequency );
Parameters
lpliFrequency
[out] Points to a variable that the function sets to the current frequency of the performance counter; the frequency is given in counts per second. If the installed hardware does not support a high-resolution performance counter, this parameter can be set to zero.
Return Values
TRUE if the installed hardware supports a high-resolution performance counter; otherwise FALSE.

Remarks
The Platform Builder includes a default implementation of this function. In some cases, the QueryPerformanceCounter functionality is implemented by using GetTickCount. In these cases, a call to this function returns 1,000 (1,000 ticks per second).

The default implementation of QueryPerformanceFrequency can be replaced by defining a custom high-resolution timer function based on the target device’s CPU. The custom high-resolution timer functions must be implemented in the OAL code and then be exposed to the kernel. To do this, the kernel exposes the global variable pQueryPerformanceFrequency.

Initialize pQueryPerformanceFrequency to point to the equivalent private function (for example, OEMQueryPerformanceFrequency). This should be initialized in OEMInit. Once pQueryPerformanceFrequency is initialized, it points to the OAL implementation to retrieve the high-resolution timers.

一条晚起的虫 2010-10-14
  • 打赏
  • 举报
回复
// The return value is the number of milliseconds that have elapsed since the system was started
// The resolution of the GetTickCount function is limited to the resolution of the system timer, which is typically in the range of 10 milliseconds to 16 milliseconds.

// 1 tick就是1ms,GetTickCount的典型精度是10-16ms
hilevel 2010-10-14
  • 打赏
  • 举报
回复
MSDN上是这么说的
The resolution of the system timer is based on the OEMs setting. Check with the OEM for details.

看来是由硬件决定的

16,546

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧