[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Custom Performance counters- (RateOfCountsPerSecond32

Ken

9/11/2008 1:54:00 PM

I successfully created some performance counters to instrument a .Net
application. These counters simply count the number of Order (based on
NumberOfItems32 type). Now I want a counter that will track the rate
of operations- number of Order processed per second. So I added
another counter of type RateOfCountsPerSecond32. As soon as I added
this new counter the other counters started to behave in a starange
but consistent manner.

In a unit test-
- I create the set of counters
Within a loop-
- Increment each of them by using by using the method -Increment().
- Increment the Operations/Second (RateOfCountsPerSecond32) counter by
using a random generated number.(IncrementBy method)

public static void TestCounters()
{
ResetCounters();
Random r = new Random();
for (int i = 0; i < 50000; i++)
{
int a = r.Next(10, 100);
OrderCount.Increment(); //NumberOfItems32
OrdersPerSecond.IncrementBy(a); //
RateOfCountsPerSecond32
ExceptionOrderCount.Increment(); //NumberOfItems32
System.Threading.Thread.Sleep(50);
}
}

RESULTS-
Instead of a rate, Performance Monitor shows a cumulative value for
OrderPerSecond counter. The value is constantly incrementing as
opposed to displaying a rate per second. OrderCount show the value
0.00 (stange!!).

Though OrderCount counter does not change, it's shows a float value
0.00. I would think that OrdersPerSecond counter should be a float
value instead. The two counter seems to be mixed up??

Am I using these counters incorrectly? Do I need to do something else
to use the RateOfCountsPerSecond32 counter type?

WHEN I TAKE OUT THE RateOfCountsPerSecond32 COUNTER TYPE, THE
REMAINING COUNTERS START TO FUNCTION FINE.

Please help, I am out of ideas. Thank you,

Ken