472,127 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

PerformanceCounter(), multiple instances

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

Feb 28 '07 #1
5 8056
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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

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

Mar 1 '07 #2
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
"Luke Zhang [MSFT]" wrote:
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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

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

Mar 1 '07 #3
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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

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

Mar 5 '07 #4
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

"Luke Zhang [MSFT]" wrote:
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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

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

Mar 6 '07 #5
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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

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

Mar 7 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by BuddyWork | last post: by
3 posts views Thread by Rob Meade | last post: by
1 post views Thread by bobido | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.