这是个问题.我正在开发一个名为CreateCounters的方法,它将为应用程序创建性能计数器.该方法包括以下代码.
void CreateCounters()
{
if(!PerformanceCounterCategory.Exists("Contoso"))
{
var counters = new CounterCreateationDataCollection();
var ccdCounter1 = new CounterCreationData
{
CounterName = "Counter1";
CounterType = PerformanceCounterType.SampleFraction;
};
counters.Add(ccdCounter1);
var ccdCounter2 = new CounterCreationData
{
CounterName = "Counter2";
// need insert PerformanceCounterType
};
counters.Add(ccdCounter2);
PerformanceCounterCategory.Create("Contoso","Help dtring",
PerformanceCounterCategoryType.MultiInstance, counters);
}
}
Run Code Online (Sandbox Code Playgroud)
我需要确保Counter1可用于Windows性能监视器(PerfMon).你应该插入哪个代码段?
有四种选择.
A. CounterType = PerformanccCounterType.RawBase
B. CounterType = PerformanceCounterType.AverageBase
C. CounterType = PerformanceCounterType.SampleBase
D. CounterType = PerformanceCounterType.CounterMultiBase
Run Code Online (Sandbox Code Playgroud)
我不知道是哪一个,为什么?
看到这个:
那里有一个表显示PerformanceCounterType.SampleFraction需要一个PerformanceCounterType.SampleBase类型的denomonator
(和RawFraction需要RawBase等)
| 归档时间: |
|
| 查看次数: |
4176 次 |
| 最近记录: |