Programming 版 (精华区)

发信人: Scorpion (但教心似金钿坚), 信区: Programming
标  题: [合集]请教!!
发信站: 哈工大紫丁香 (2002年03月28日09:33:52 星期四), 站内信件

发信人: zhangzg (生活如老子工作如小子), 信区: Programming
标  题: 请教!!
发信站: 哈工大紫丁香 (2001年04月06日13:00:37 星期五), 站内信件

用Delphi4编程,
我想测试一下for循环执行的时间,请问用什么函数能够精确的毫秒级。
用timer控件似乎不行,ontimer事件总是在for循环执行完之后才被
执行,不管for循环多么长。

--
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.235.156]
发信人: Scorpion (The Sky's Limit!), 信区: Programming
标  题: Re: 请教!!
发信站: 哈工大紫丁香 (2001年04月06日13:46:34 星期五), 站内信件

用Windows API:GetTickCount

MSDN:

The GetTickCount function retrieves the number of milliseconds that have ela
psed since the system was started. It is limited to the resolution of the sy
stem timer.
If you need a higher resolution timer, use amultimedia timer or a high-resol
ution timer.
DWORD GetTickCount(VOID)

【 在 zhangzg (生活如老子工作如小子) 的大作中提到: 】
: 用Delphi4编程,
: 我想测试一下for循环执行的时间,请问用什么函数能够精确的毫秒级。
: 用timer控件似乎不行,ontimer事件总是在for循环执行完之后才被
: 执行,不管for循环多么长。

--

※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: mtlab5.hit.edu.cn]
发信人: zhangzg (生活如老子工作如小子), 信区: Programming
标  题: Re: 请教!!
发信站: 哈工大紫丁香 (2001年04月06日14:34:35 星期五), 站内信件

thank you!
the func is very good!
Could you tell me where the high-resolution timer is?

【 在 Scorpion (The Sky's Limit!) 的大作中提到: 】
: 用Windows API:GetTickCount
: MSDN:
: The GetTickCount function retrieves the number of milliseconds that have ela
: psed since the system was started. It is limited to the resolution of the sy
: stem timer.
: If you need a higher resolution timer, use amultimedia timer or a high-resol
: ution timer.
: DWORD GetTickCount(VOID)

--
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.235.156]
发信人: xxxxx (因为寂寞), 信区: Programming
标  题: Re: 请教!!
发信站: 哈工大紫丁香 (2001年04月06日14:37:23 星期五), 站内信件

理论上微秒极,实际上毫秒极

【 在 Scorpion (The Sky's Limit!) 的大作中提到: 】
: 用Windows API:GetTickCount
: MSDN:
: The GetTickCount function retrieves the number of milliseconds that have ela
: psed since the system was started. It is limited to the resolution of the sy
: stem timer.
: If you need a higher resolution timer, use amultimedia timer or a high-resol
: ution timer.
: DWORD GetTickCount(VOID)

--
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: alioth.hit.edu.cn]
发信人: lofe (〖感激生活〗), 信区: Programming
标  题: Re: 请教!!
发信站: 哈工大紫丁香 (2001年04月06日14:39:48 星期五), 站内信件

see this:

 1030 b lofe         Sep  2. ● 在Windows中使用精确计时器[转载]

【 在 zhangzg (生活如老子工作如小子) 的大作中提到: 】
: thank you!
: the func is very good!
: Could you tell me where the high-resolution timer is?
: 【 在 Scorpion (The Sky's Limit!) 的大作中提到: 】
: : 用Windows API:GetTickCount
: : MSDN:
: : The GetTickCount function retrieves the number of milliseconds that have ela
: : psed since the system was started. It is limited to the resolution of the sy
: : stem timer.
: : If you need a higher resolution timer, use amultimedia timer or a high-resol

--
我们更要探讨Windows系统编程技术(Programming)

                  独孤九剑的最高境界是不拿剑
                  编程的最高境界是无所谓工具
 有空的时候,看看 MSDN ,真的很不错。

※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: DnC.hit.edu.cn]
※ 修改:·lofe 於 04月06日14:39:55 修改本文·[FROM: DnC.hit.edu.cn]
发信人: zhangzg (生活如老子工作如小子), 信区: Programming
标  题: Re: 请教!!
发信站: 哈工大紫丁香 (2001年04月06日15:28:59 星期五), 站内信件

试了一下,循环次数很大的话,精度还是可以的(虽然并不准确)
dephi下,一个for的空循环大约持续3ns.循环次数小的话,程序执行的
时间就不能忽略了。
【 在 lofe (〖感激生活〗) 的大作中提到: 】
: see this:
:  1030 b lofe         Sep  2. ● 在Windows中使用精确计时器[转载]
: 【 在 zhangzg (生活如老子工作如小子) 的大作中提到: 】
: : thank you!
: : the func is very good!
: : Could you tell me where the high-resolution timer is?

--
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.235.156]
发信人: zhangzg (生活如老子工作如小子), 信区: Programming
标  题: Re: 请教!!
发信站: 哈工大紫丁香 (2001年04月06日15:30:19 星期五), 站内信件

感谢诸位高手!!
【 在 zhangzg (生活如老子工作如小子) 的大作中提到: 】
: 试了一下,循环次数很大的话,精度还是可以的(虽然并不准确)
: dephi下,一个for的空循环大约持续3ns.循环次数小的话,程序执行的
: 时间就不能忽略了。
: 【 在 lofe (〖感激生活〗) 的大作中提到: 】
: : see this:
: :  1030 b lofe         Sep  2. ● 在Windows中使用精确计时器[转载]

--
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.235.156]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.402毫秒