I have an application that uses a System.Timers.Timer object to raise events that are processed by the main form (Windows Forms, C#). My problem is that no matter how short I set the .Interval (even to 1 ms) I get a max of 64 times per second.
I know the Forms timer has a 55 ms accuracy limit, but this is the System.Timer variant, not the Forms one.
The application sits a 1% CPU, so it's definitely not CPU-bound. So all it's doing is:
- Set the Timer to 1&nsp;ms
- When the event fires, increment a _Count variable
- Set it to 1&nsp;ms again and repeat
_Count gets incremented a maximum of 64 times a second even when there's no other work to do.
This is an "playback" application that has to replicate packets coming in with as little as 1-2 ms delay between them, so I need something that can reliably fire 1000 times a second or so (though I'd settle for 100 if I was CPU bound, I'm not).
Any thoughts?
See Question&Answers more detail:os