Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop custom performance counter instance names from being auto converted to lower case

Tags:

performance

c#

I have created a multi-instance performance counter and I pass it mixed case instance names but somehow the instance names get converted to lower case when I view them both through code and in perfmon. Does anyone know how to prevent this? Found this on google, thought it was nice of Luke Zhang to never follow up.

like image 956
HasaniH Avatar asked Jun 16 '09 15:06

HasaniH


1 Answers

I used Reflector to look at the code in System.dll for the PerformanceCounter. In the private Initialize event is this little nugget:

this.sharedCounter = new SharedPerformanceCounter(categoryName.ToLower(CultureInfo.InvariantCulture), this.counterName.ToLower(CultureInfo.InvariantCulture), this.instanceName.ToLower(CultureInfo.InvariantCulture), this.instanceLifetime);

I think that's why.

like image 123
Alan McBee Avatar answered Nov 03 '22 20:11

Alan McBee