0
我正试图创建一个Windows手机应用程序,记录加速度计数据在100赫兹。我试用了System.Windows.Threading.DispatcherTimer
和System.Threading.Timer
,但是查看记录的数据,实际上都没有以100Hz记录。 DispatcherTimer
记录60-80Hz,而Timer
记录在85-90Hz左右。我不认为问题在于手机无法处理它,因为当我尝试以50赫兹进行记录时,它仍然滞后于40赫兹以上。这里是我的代码片段:如何确保定时记录在固定的时间间隔?
为DispatcherTimer
:
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMilliseconds(10);
timer.Tick += new EventHandler(timer_Tick);
为Timer
:
timer = new Timer(timer_Tick, null, 0, 10);
如何确保我在一个固定的速度间隔记录?