Create a performance counter with an instance name

K

Kai Wang

I use the following two lines of code to create a performance counter with an
instance name.

PerformanceCounterCategory.Create(m_CategoryName, "",
PerformanceCounterCategoryType.MultiInstance, m_CounterName, "");

PerformanceCounter counter = new PerformanceCounter(m_CategoryName,
m_CounterName, "test", false);

But I get this exception:
"Category 'cat' is marked as single-instance. Performance counters in this
category can only be created without instance names."

Any idea?

Thanks.

Kai
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top