Timer Events
-
Hi all :laugh: I have a timer on my form and its intervel is 1 milli sec 1 Seconds =1000 Mili Sec So my timer should be fired 1000 times in 1 Sec but it fires only 60-65 times in 1 sec i have not use lenthy process in it only increase the integer value by 1 each time it fires n check it after 1 sec In Timer event i used only IntValue+=1 After 1 Sec IntValue is reached at 60-65 Can anyone tell me wht is happnening behind it?? Thanks with anticipations :-O
Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...
-
Hi all :laugh: I have a timer on my form and its intervel is 1 milli sec 1 Seconds =1000 Mili Sec So my timer should be fired 1000 times in 1 Sec but it fires only 60-65 times in 1 sec i have not use lenthy process in it only increase the integer value by 1 each time it fires n check it after 1 sec In Timer event i used only IntValue+=1 After 1 Sec IntValue is reached at 60-65 Can anyone tell me wht is happnening behind it?? Thanks with anticipations :-O
Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...
How fast is your processor? Does it work if you set it, to say, 5ms delay?
Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen Click here to view my blog
-
How fast is your processor? Does it work if you set it, to say, 5ms delay?
Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen Click here to view my blog
-
My processor speed is 2.0 GHz and Ram Speed is 1 GB Can u give the reason why it is happening??? Thanks 4 ur reply :-O
Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...
Did you try running it with the timer inverval a bit higher?
Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen Click here to view my blog
-
Did you try running it with the timer inverval a bit higher?
Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen Click here to view my blog
-
I set 5 ms the intervel so it fired only 63 times in 1 Seconds In 1 Seconds Intervell(ms)->Fired (Data) 5->63 50->15 100->9 times fired
Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...
Although it dosent make sense to me (as your computer is not that slow) I do find it odd that at the lower intervals (i.e 5) the amount of fired events is way off target, but at higher intervals (i.e 100) it is close to its target. There has to be something, somewhere, that is slowing down the amount of time it takes to execute the timer tick event. If not, i'm dumbfounded.
Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen Click here to view my blog
-
Although it dosent make sense to me (as your computer is not that slow) I do find it odd that at the lower intervals (i.e 5) the amount of fired events is way off target, but at higher intervals (i.e 100) it is close to its target. There has to be something, somewhere, that is slowing down the amount of time it takes to execute the timer tick event. If not, i'm dumbfounded.
Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen Click here to view my blog
Thanks for your time.... Recently i found in my search that The Windows Forms Timer simply isn't that accurate :omg: . I know - we'd think that if it promises you millisecond intervals it could produce the goods, but fact is it doesn't. :confused:
Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...
-
Thanks for your time.... Recently i found in my search that The Windows Forms Timer simply isn't that accurate :omg: . I know - we'd think that if it promises you millisecond intervals it could produce the goods, but fact is it doesn't. :confused:
Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...
Assuming your using the System.Windows.Forms.Timer (in the Toolbox), you simply would have had to read the documentation on it (click on the Timer on your form, then hit F1) to find this: Note: The Windows Forms Timer component is single-threaded, and is limited to an accuracy of 55 milliseconds. If you require a multithreaded timer with greater accuracy, use the Timer class in the System.Timers namespace. In practice, your actual accuracy will vary, depending on system load, application load, and hardware capabilities.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Hi all :laugh: I have a timer on my form and its intervel is 1 milli sec 1 Seconds =1000 Mili Sec So my timer should be fired 1000 times in 1 Sec but it fires only 60-65 times in 1 sec i have not use lenthy process in it only increase the integer value by 1 each time it fires n check it after 1 sec In Timer event i used only IntValue+=1 After 1 Sec IntValue is reached at 60-65 Can anyone tell me wht is happnening behind it?? Thanks with anticipations :-O
Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...
I can't remember which way the Win.Forms Timer class works, but I'm pretty certain it marshalls events back onto the UI thread using Form.Invoke. That means you are limited to the speed of the windows message loop, and definitely the scheduling quanta, which is about 50ms. There's another Timer class somewhere, but I doubt that will get down to 1ms accurately. Any other thread that takes up the CPU is going to get a whole 50ms to itself, blocking your stuff.
Mark Churchill Director, Dunn & Churchill Pty Ltd Free Download: Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.
Alpha release: Entanglar: Transparant multiplayer framework for .Net games.