PerformanceCounter Page Faults/sec RRS feed

  • Frage

  • Hello,

    due to performance issues a control computer at a manufacturing plant we have to Monitor some Parameters of the Memory Management, so also the page faults per second. We try to do it like this


    PerformanceCounterpcPageFaultsSec = newPerformanceCounter("Memory", "Page Faults/sec");

    dPageFaultsSec =  pcPageFaultsSec.NextValue();

    textBoxPageFaultsSec.Text = dPageFaultsSec.ToString("0.0");

    But here we always get a value of Zero, although perfmon Shows values not equal zero.

    What's wrong ?


    Freitag, 23. September 2016 10:05


  • Hi Gerhard,

    you will have to query the value more than once, use a loop to get some results:

            private void PerformancePageFaults()
                PerformanceCounter pageFaultsSec = new PerformanceCounter("Memory", "Page Faults/sec");
                for (int index = 0; index < 10; index++)
                    Console.WriteLine($"Page Faults/sec {pageFaultsSec.NextValue()}");

    As a sample result:

    Page Faults/sec 0
    Page Faults/sec 799,3115
    Page Faults/sec 740,2796
    Page Faults/sec 300,9994
    Page Faults/sec 1076,908
    Page Faults/sec 626,9908
    Page Faults/sec 475,5057
    Page Faults/sec 650,9771
    Page Faults/sec 830,4797
    Page Faults/sec 279,9876

    Regards, Elmar

    Freitag, 23. September 2016 15:03