PerformanceCounter(), multiple instances

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi...

I've got some custom performance counters that can have multiple instances.
I use the PerformanceCounter() constructor with the instance name parameter.
The thing that puzzles me, though, is that when I look in Perfmon for those
counters, the instance name I've passed in has been lowercased. Why would
that be? If you look at the Processes counter, it has mixed case instances.

Thanks
_Mark
 
Hello Mark,

Is the problem only occur with all the custom performance counters? As I
understand, you get correct instance name in your .NET application, but
incorrect name (lowcase) in Perfmon, is my understanding right? This seems
not be a programming issue, since only Perfmon has this problem. You may
consult the vendor of the custom performance counters, to see if they know
the problem with thier performance counters in Perfmon.

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Luke...

The custom performance counters are our own, using the .Net
System.Diagnostics classes (PerformanceCounter, etc). We pass in an instance
name of mixed case but when we look at the counters in perfmon, the instance
is in all lower case.

Looking at other multi-instance counters in perfmon, it's clear that *other*
counters don't have their instance names case-normalized.

It appears to be more a weird behavior of the .Net framework classes, though
I'm scratching my head why they would do this.

I was hoping someone on one of the newsgroups would know why this happens.

Thanks
-Mark
 
Hello mark,

I build a sample performance counter in VS.NET 2005 based on this article:

http://support.microsoft.com/kb/317679

But I didn't find the issue. Maybe you can also test this sample on your
server to see if it is a code issue or an environment issue.

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Luke...

I think I see your problem - you're not creating multi-instance counters,
only single instance. That's not what I'm referring to. Multi-instance
counters have the same structure but can have multiple instantiations as
different processes use copies of them.

If you replace
PerformanceCounterCategory.Create("HowToCounter", "some...", CounterDatas);
with
PerformanceCounterCategory.Create("HowToCounter", "some...",
PerformanceCounterCategoryType.MultiInstance, CounterDatas);

and
Dim PerfCounter As New PerformanceCounter("HowToCounter", "ThreadCounter",
False)
with
Dim PerfCounter As New PerformanceCounter("HowToCounter", "ThreadCounter",
"MixedCaseInstance", False)

in the example you were using, you'll be getting a multi-instance counter
this time and should see the case normalization I was referring to.

Thanks
-Mark
 
Hi Mark,

Thank you for the information, I also found the problem with the code. I
will perform further research on it and update you as soon as possible.

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top