Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Overhead using System.Timers.Timer
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Overhead using System.Timers.Timer
Divers
Thread ID:
00940086
Message ID:
00940086
Vues:
66
I am creating a Windows service that uses a timer (System.Timers.Timer) to perform some tasks at specific intervals.
In the OnStart of the Windows Service I create a new instance of my class:
protected override void OnStart(string[] args)
{
  oMyClass = new MyClass();
}
In the constructor of MyClass I start a new timer
public MyClass
{
  oTimer = new System.Timers.Timer();
  oTimer.Elapsed += new System.Timers.ElapsedEventHandler(oTimer_Elapsed);
  oTimer.Interval = 1000 * 25;
  oTimer.Start();
  oTimer_Elapsed(this,null);	
}
And now here comes the question: In addition to the things (thing#1) I want done every 25 seconds I also want some things (thing#2) done lets say every 100 seconds. Is there a lot of overhead accosiated with a timer object so that I should look into creating logic that does thing#2 every 4th time the timer fires (thing#1 is done) or should I add another timer with Interval = 1000 * 100 for thing#2?

Please comment on any other parts of how I set up my windows service.

Thanks,
Einar
Semper ubi sub ubi.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform