-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Nasha
Message 1 in Discussion
Hey Group,
In the past 3 days we have created our windows service, added installers to it,
Created event logged our service today we will add performance counters.
Performance counter helps us to monitor performance of our service. Say if want
to know how many files are moved, what is the number of files moved per second
/minute etc.
Before we add performance counter we will add NoOfFiles property to our
MoveFile class.
private long noOfFiles=0;
public long NoOfFiles
{
get
{
return noOfFiles;
}
}
To add performance counter to our windows service : <o:p></o:p> Go to
Server Explorer<o:p></o:p> Go to Servers<o:p></o:p> Under that
you will see your machine name <o:p></o:p> Expand the node under that you
will see performance counters.<o:p></o:p> Right click that and select
create new category<o:p></o:p> Performance counter builder dialog will
open up.<o:p></o:p> Add the category name say "MoveFilesService" or your
service name<o:p></o:p> Add the description <o:p></o:p> Click on
New<o:p></o:p> Add the counter name ... "NoOfFilesMoved"<o:p></o:p>
Type should be NumberOfItems32<o:p></o:p> Enter the description �
"NoofFilesMoved"<o:p></o:p> And Click on Ok.<o:p></o:p>
Check the tree view on your left your Performance counter category
(MoveFilesService) and its counter (NoOfFilesMoved) should be created.
Drag and drop the NoOfFilesMoved Performance counter from the tree view on
MoveFileService (design mode). Performancecounter1 will be created rename it as
PCNoOfFiles .. Check out its properties.
After adding the performance counter we will add a timer to our service that
will help us to refresh PCNoOfFiles value after every second.
Drag and Drop a timer control on MoveFileService from the components tab in
your toolbox.
Double click on timer control it should go to its _Elaspsed event. We will
assign the value of NoOfFiles to our performance counters rawvalue.
private void timer1_Elapsed(object sender,
System.Timers.ElapsedEventArgs e)
{
PCNoOfFiles.RawValue = oMoveFile.NoOfFiles;
}
Build your project. Install the service � start your service ... go to
Administrative Tools ... Performance.
Select System Monitor on your system performance monitor. Click on the Add
toolbar button on your right to open. Add Counters dailog box.
Select MoveFilesService in the Performance Object select box and Click on Add.
You will see a red bar moving and displaying you the no of files moved. Check
out the last, average, minimum, maximum and duration parameters.
Note: To view good graphs add some files in your FileToMove Folder and then
view the performance.<o:p></o:p>
-- Please post your queries and comments for my articles in the user group for
the benefit of all. I hope this step from my end is helpful to all of us.
Regards,
Namratha (Nasha) <o:p></o:p>
<o:p></o:p>
<o:p></o:p>
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]