Note that there are some explanatory texts on larger screens.

plurals
  1. POPerformance counters incrementing improperly?
    primarykey
    data
    text
    <p>Probably a rookie error, but i'm getting something strange. i'm trying to weave a .NET performance counter into an application. </p> <p>When i call the <code>incrementBy(value)</code> method on my avg performance counter it is changing the RawValue of my base counter by value as well. i checked the variable names and think everything is correct.</p> <p>Then when i call <code>increment()</code> on my base counter it adds 1 to the rawvalue of the avgcounter as well as incrementing the base counter... adding insult to injury!</p> <p>Has anyone else seen this kind of behavior? Any suggestions for what's going on and how to fix it?</p> <p>In code i'm using two different counters to measure the time a merge sort i wrote takes. i have a instantaneous counter for the elapsed time of the sort and an average counter.</p> <pre><code>Dim timePiece As New Stopwatch() timePiece.Start() MergeSort() timePiece.Stop() ElapsedCounter.RawValue = timePiece.ElapsedMilliseconds AvgCounter.IncrementBy(timePiece.ElapsedMilliseconds) AvgCounterBase.Increment() </code></pre> <p>What i'm seeing occur is:</p> <pre><code>'Elapsed counter works as expected 'AvgCounter RawValue is 7, AvgCounterBase RawValue is also 7 before incrementing </code></pre> <pre> AvgCounter.IncrementBy(value) 'AvgCounter.RV is 7+value, AvgCounterBase is 7+value AvgCounterBase.Increment() 'AvgCounter.RV is 7+value+1, AvgCounterBase is 7+value+1 </pre> <p>i think i may be using the counters wrong, but why does changing the rawvalue of the average seem to also change the rawvalue of the base? i dont think that's supposed to happen.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload