定时器潜在的6ms延迟 - ~6ms latency in the timer


  如果你做过Windows mobile Gesture开发,就会在 GesturePhysicsEngine.h 头文件发现如下一段定义说明:

/// <summary>
/// Defines a common value for a normal frame delay rate expected to be used when displaying
/// output from the physics engine. We are aiming at 25fps and also allow ~6ms latency in the timer
/// </summary>
#define GESTURE_ANIMATION_FRAME_DELAY_MS  34 

 

该文件在 “..\Windows Mobile 6 SDK\PocketPC\Include\Armv4i\  目录下。注释的大概意思为:

    “为普通帧延迟率定义一个公共值,该值在从物理引擎显示输出时使用 。目标是25fps并且允许定时器中潜在的6ms延迟。”

 

从上面的注释我们可以知道:在每帧刷新后可能有6秒延迟,设置的延迟为34ms,所以实际的每帧需要的时间为40ms。

上面的定义也说明了这点:

#define GESTURE_ANIMATION_FRAME_DELAY_MS  34 

1000 / 34 ≈ 29; 

如果考虑到6ms的延迟,那么:

1000 / (34 + 6) = 25;

刚好和注释中的25fps吻合,这也就证明了我们的观点。 

  


 

 

posted on 2010-01-29 14:45  listenlisten  阅读(743)  评论(3编辑  收藏  举报

导航