What is the minimum value of a Timer

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

Is there a limit to how low you can set a timer?

I know it can be set to 1 millisecond, but will it fire that often?

Isn't it something like 50 milliseconds and any lower will make no
difference?

Thanks,
Ken
 
Ken,

When i use a performance counter i get the following values.

Calls to the Timer1_Tick Sub (with very little code in the sub)
50 ms = about 16 calls
10 ms = about 65 calls
1 ms = about 64 calls

Greetings,
Oldschool2
 
Ken said:
Is there a limit to how low you can set a timer?

I know it can be set to 1 millisecond, but will it fire that often?

Isn't it something like 50 milliseconds and any lower will make no
difference?

Thanks,
Ken
The standard PC clock interrupts every 18 and a bit milliseconds. I
suspect that is the granularity of the timer.
 
Ken,
In addition to the other comments.

Which timer are you referring to? There are 3 timers in .NET:
System.Timers.Timer, System.Threading.Timer, and System.Windows.Forms.Timer.

Comparing the Timer Classes in the .NET Framework Class Library
http://msdn.microsoft.com/msdnmag/issues/04/02/TimersinNET/default.aspx

Implement a Continuously Updating, High_Resolution Time Provider for Windows
http://msdn.microsoft.com/msdnmag/issues/04/03/HighResolutionTimer/default.aspx


--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| Is there a limit to how low you can set a timer?
|
| I know it can be set to 1 millisecond, but will it fire that often?
|
| Isn't it something like 50 milliseconds and any lower will make no
| difference?
|
| Thanks,
| Ken
|
|
 
Ken,

I don't know where you can find the exact granularity but when you add
a performance counter to the tick events you will find some rough
figures.

System.Windows.Forms.Timer:
Then the maximum rate (interval = 1 ms) will be 64 calls each second to
the Timer1_Tick Sub.

System.Timers.Timer.Timer:
Then the maximum rate (interval = 1 ms) will be 128 calls each second
to the oTimer_Tick Sub.

But more important you can not rely on the counter because if you ad
more complex code to the tick event the figures will be lower than the
figures above.

Greetings,

Marcel Wiegand
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top