.net - Performance counters incrementing improperly? -


Text after "

Perhaps there is an error in the beginning, but I'm getting something strange. I have an application in one. I am trying to knit NET display counter.

When I incrementBy (value) method on my average performance counter changing RawValue their base area on the basis of price as well as call . I checked the variable name and it seems that everything is correct. Of

So as well as when I my base incrementing based counter as the counter increment () call it adds 1 to rawvalue of avgcounter ... Injury Adding humiliation!

Have seen such behavior? What is happening and there is some suggestion to fix it?

The code I used to type in a merge like I wrote two separate counters to measure. I have an improvised counter for a time elapsed and average counters.

  dim watch new Stopwatch () timePiece.Start () MergeSort () timePiece.Stop (as) ElapsedCounter.RawValue = timePiece.ElapsedMilliseconds AvgCounter.IncrementBy (timePiece.ElapsedMilliseconds) AvgCounterBase.Increment ()  

what is the hope that as I have been then appears:

  'elapsed counter work' AvgCounter RawValue 7 is, AvgCounterBase RawValue even before the incremental 7  
 AvgCounter.IncrementBy (value) 'AvgCounter.RV 7 + value, AvgCounterBase 7 + value AvgCounterBase.Increment ()' AvgCounter.RV 7 + value is + 1, average customer 7 + value + 1 

I think I can count Can misused s say, but changes Why change the raw properties of an average raw material? I think this is not going to happen.

This behavior should work on this. Growth and growth by basically modified directly Kchchevlu you can do what you do, it really thread-safe version when the counter is accessible only by these methods by the same thread:

 < Code> counterwereable.value cost ++; Counter Variable Ravavrao = 2;  

These statements are equivalent to:

  counterwebable.ignment (); CounterVariable.IncrementBy (2);  

If access is done through multiple threads, modifying RawValue is not thread-safe and may possibly lose some updates.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -