Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using performance counters with different UI languages

I would like to read a few performance counters in my C# application, like "Processor\% Idle Time", but this only works on English systems. Since performance counters need to be initialized using the counter category and names, how can I make my code run under different UI languages?

like image 435
Jon Tackabury Avatar asked Nov 06 '22 07:11

Jon Tackabury


1 Answers

After much searching, I found this MS KB article that explains how to retrieve the localized counter names using hard-coded index values: http://support.microsoft.com/kb/287159

Once you get the hard-coded index value from the registry, just pass it to the PdhLookupPerfNameByIndex method and it will return the localized counter name.

like image 141
Jon Tackabury Avatar answered Nov 11 '22 05:11

Jon Tackabury