我正在通过代码创建一个性能计数器。作为参考 CounterName、CategoryName、CategoryHelp、InstanceName 是 const 字符串。
//creating the category
var counterData = new CounterCreationDataCollection();
var counterCreationData = new CounterCreationData(CounterName, "", CounterType);
counterData.Add(counterCreationData);
PerformanceCounterCategory.Create(CategoryName, CategoryHelp,
PerformanceCounterCategoryType.MultiInstance, counterData);
//creating the counter
_counter = new PerformanceCounter(CategoryName, CounterName, InstanceName, false);
_counter.Increment();
如何反映通过代码创建的性能计数器的性能监视器?