You are developing a method named CreateCounters that will create performance counters for an application.
The method includes the following code. (Line numbers are included for reference only.)
You need to ensure that Counter1 is available for use in Windows Performance Monitor (PerfMon).
Which code segment should you insert at line 16?
A.
CounterType = PerformanccCounterType.RawBase
B.
CounterType = PerformanceCounterType.AverageBase
C.
CounterType = PerformanceCounterType.SampleBase
D.
CounterType = PerformanceCounterType.CounterMultiBase
Explanation:
PerformanceCounterType.SampleBase – A base counter that stores the number of sampling interrupts taken
and is used as a denominator in the sampling fraction. The sampling fraction is the number of samples that
were 1 (or true) for a sample interrupt. Check that this value is greater than zero before using it as thedenominator in a calculation of SampleFraction.
PerformanceCounterType.SampleFraction – A percentage counter that shows the average ratio of hits to all
operations during the last two sample intervals. Formula: ((N 1 – N 0) / (D 1 – D 0)) x 100, where the numerator
represents the number of successful operations during the last sample interval, and the denominator
represents the change in the number of all operations (of the type measured) completed during the sample
interval, using counters of type SampleBase. Counters of this type include Cache\\Pin Read Hits %.
http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecountertype.aspx