Alex Rivera | Logout

How can I add a performance counter to a category i have already created

Asked 2009-06-05T21:07:21.367
26

I have created a PerformanceCounterCategory like below

var category = PerformanceCounterCategory.Create("MyCat", "Cat Help",
    PerformanceCounterCategoryType.SingleInstance, "MyCounter", "Counter Help);

How can I add a new counter to the category to monitor another item?
I cannot find the api for it.

Edit
Report

2 Answers

33

I did a research on this a while back and it doesn't seem to be possible to add counters to an existing category, what you would have to do it to recreate the same category with addition of the new counter.

answered 2009-06-08T19:15:15.107
-4
PerformanceCounter lCounter = new PerformanceCounter(Category, CounterName, 
                                                     false);
lCounter.MachineName = ".";
answered 2009-06-05T21:19:53.743

Your Answer