c# - How to ensure timer records at fixed interval? -


i'm trying create windows phone application records accelerometer data @ 100 hz. tried out both system.windows.threading.dispatchertimer , system.threading.timer, looking @ data recorded, neither recording @ 100 hz. dispatchertimer records 60-80 hz, while timer records @ around 85-90 hz. don't think problem phone not being able handle it, since when tried recording @ 50 hz, still lagging 40+ hz. here snippet of code:

for dispatchertimer:

timer = new dispatchertimer(); timer.interval = timespan.frommilliseconds(10); timer.tick += new eventhandler(timer_tick); 

for timer:

timer = new timer(timer_tick, null, 0, 10); 

how make sure recording @ fixed rate interval?

windows phone 7 - not real-time os. none of timer classes precise. you're doing saying want wait @ least long. takes amount of time fire , end notified timer has ticked once os gets around servicing tick message.
try implement simple test: print current time every 10 milliseconds, , can see minimum error. when developers use 1 or 5 or 10 seconds interval - not noticeable.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -