G
Guest
I am implimenting Performance counters into a web application.
I use the following code to create the counters during setup:
private void SetupPerfCntrs()
{
System.Diagnostics.CounterCreationDataCollection CounterDatas = null;
System.Diagnostics.CounterCreationData cdCounter4 = null;
try
{
if(System.Diagnostics.PerformanceCounterCategory.Exists("LogisOnline"))
{
System.Diagnostics.PerformanceCounterCategory.Delete("LogisOnline");
}
// Create a collection of type CounterCreationDataCollection.
CounterDatas = new System.Diagnostics.CounterCreationDataCollection();
// Create the counters and set their properties.
cdCounter4 = new System.Diagnostics.CounterCreationData();
cdCounter4.CounterName = "PaymentsView Response";
cdCounter4.CounterHelp = "Time in millisecods for Payment View call to
respond";
cdCounter4.CounterType =
System.Diagnostics.PerformanceCounterType.NumberOfItems32;
// Add both counters to the collection.
CounterDatas.Add(cdCounter4);
// Create the category and pass the collection to it.
System.Diagnostics.PerformanceCounterCategory.Create("LogisOnline", "Logis
Online Web Application Metrics", CounterDatas);
}
catch(Exception ex)
{
throw ex;
}
finally
{
CounterDatas = null;
cdCounter4 = null;
}
}
The code used to write to the performance counters are as follows:
Dim PCPaymentView As System.Diagnostics.PerformanceCounter = New
System.Diagnostics.PerformanceCounter("LogisOnline", "PaymentsView Response",
"_Total", False)
Dim StartTime As DateTime = DateTime.Now
I use the following code to create the counters during setup:
private void SetupPerfCntrs()
{
System.Diagnostics.CounterCreationDataCollection CounterDatas = null;
System.Diagnostics.CounterCreationData cdCounter4 = null;
try
{
if(System.Diagnostics.PerformanceCounterCategory.Exists("LogisOnline"))
{
System.Diagnostics.PerformanceCounterCategory.Delete("LogisOnline");
}
// Create a collection of type CounterCreationDataCollection.
CounterDatas = new System.Diagnostics.CounterCreationDataCollection();
// Create the counters and set their properties.
cdCounter4 = new System.Diagnostics.CounterCreationData();
cdCounter4.CounterName = "PaymentsView Response";
cdCounter4.CounterHelp = "Time in millisecods for Payment View call to
respond";
cdCounter4.CounterType =
System.Diagnostics.PerformanceCounterType.NumberOfItems32;
// Add both counters to the collection.
CounterDatas.Add(cdCounter4);
// Create the category and pass the collection to it.
System.Diagnostics.PerformanceCounterCategory.Create("LogisOnline", "Logis
Online Web Application Metrics", CounterDatas);
}
catch(Exception ex)
{
throw ex;
}
finally
{
CounterDatas = null;
cdCounter4 = null;
}
}
The code used to write to the performance counters are as follows:
Dim PCPaymentView As System.Diagnostics.PerformanceCounter = New
System.Diagnostics.PerformanceCounter("LogisOnline", "PaymentsView Response",
"_Total", False)
Dim StartTime As DateTime = DateTime.Now