Hi there,
I have just reviewed again the handicap placed on the
server by the timer, as adjusted with the dbSca_Alert
being fired within the Timer Event processor. Despite the
fact that the task manager claims it is using 100% of cpu
time, the server actually performs other tasks whil the
timer is running at the same performance as when it is not
running. When I reviewed it yesterday (before making the
changes), a single process running at the same time as the
timer ran at 25% of the speed as when the timer was not
running. So the "cpu hog" part is no longer a problem.
The problem/issue now is the fact that this is a Form
attach timer. Is there a timer which does not need to be
attached to a form? Technically, it is possible that I
could use the form timer as is, and simply hide the form
when the timer is started, but that obviously raises all
sorts of nightmares about the possibility that other
Server users could kill the form process and so on - as
well as what happens when the server is rebooted? It would
be easy to add a scheduled task to start the timer on
system startup, but actually firing the timer itself from
a form is a bit more of a challenge. A small, unobtrusive
server timer object (not attached to a form) would be much
preferable. If you know of such a thing, please tell me
about it.
Thanks,
Paul.
Yan-Hong Huang[MSFT] - 20 Feb 2004 02:38 GMT
Hi Paul,
I am glad to hear that CPU hog problem is resolved yet.
For other kinds of timer, I have replied in your former post. The point is
to use System.Timers.Timer.
The sample code is at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemtimerstimerclassctortopic.asp
Hope that helps.
Best regards,
Yanhong Huang
Microsoft Community Support
Get Secure! ?C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Yan-Hong,
You always seem to reply to my (many) questions, so I
think it's only right to reply. I have finally got the
System.Timers.Timer option set up, and it's working great -
does the timing procedure, but doesn't chew up CPU time
at all.
Thanks,
Paul.
Yan-Hong Huang[MSFT] - 26 Feb 2004 01:53 GMT
Hi Paul,
You are welcome. I am glad to be of assistance. .NET framework has three
types of timers. Different timer is used under different situations. Jay
has provided good articles on that.
If you have further questions on programming, please feel free to post in
the group. We are glad to work with you on it.
Happy programming and have a good day! :)
Best regards,
Yanhong Huang
Microsoft Community Support
Get Secure! ?C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Jay B. Harlow [MVP - Outlook] - 20 Feb 2004 13:40 GMT
Paul,
I would recommend a System.Timers.Timer also, as Yanhong did.
For a discussion of the three timers available in .NET see:
http://msdn.microsoft.com/msdnmag/issues/04/02/TimersinNET/default.aspx
The March 2004 issue of MSDN Magazine has a second good article on Timers in
.NET:
http://msdn.microsoft.com/msdnmag/issues/04/03/default.aspx
Hope this helps
Jay
> Hi there,
>
[quoted text clipped - 27 lines]
>
> Paul.
Don McNamara - 20 Feb 2004 20:43 GMT
Paul,
I think you should look at the thread classes and in particular, the
Thread.Sleep() method. You wouldn't have to use any timers, and it would be
more CPU friendly (it won't peg the CPU at 100%.)
Something like this:
Sub DoWork()
While (Not _shouldExit)
Thread.Sleep(60000)
DoSomethingThatHitsTheDatabase()
End While
End Sub
Good luck.
Don
> Hi there,
>
[quoted text clipped - 27 lines]
>
> Paul.