none
Floating point Performance Counter RRS feed

  • Question

  • Hello,

    I am using the PerformanceCounter Class in order to setup a performance counter. The value I want to set to my performance counter is a floating point value (has decimals). However, the only property I see that enables to set the performance counter to a dynamic value each time a new value is generated is .RawValue. The problem I have with .RawValue is that it is of type long.

    If I receive a value of , let's say, 3.43 I will actually se a 3 on Performance Monitor. Which property can I use in order to observe a 3.43 value in Performance Monitor ?

     

    Code looks like this:

    static public PerformanceCounter value = new PerformanceCounter();
    
    
          counterData = new ClassCounterData(value, " A value",
                        "A value", counter++,
                        PerformanceCounterType.NumberOfItems64, categoryName, reset);
    
    //*************************************************
    // Somewhere else I call the method to change the perf counter
    
    ClassName.value.RawValue = (long)randomFloatNumber(); //Here is the problem
    

    If anyone can give me a tip as to how to resolve the issue I would really appreciate it

     

    Thanks!

     

    • Moved by Paul Zhou Tuesday, August 2, 2011 10:04 AM (From:.NET Base Class Library)
    Thursday, July 14, 2011 10:17 PM

All replies