Search code examples
windowslocalizationperformancecounterperformancepdh

Are instance names for system performance counters localized?


Performance counter names in Windows are localized, so for instance the counter \Processor(_Total)\% Processor Time is called something else in other language versions of Windows. This means that in order to find the correct name one must first find the index of the counter and then use the PdhLookupPerfNameByIndex function to get the localized name (using PdhAddEnglishCounter is out if Windows XP should be supported).

This is all good for the performance object (Processor) and counter (% Processor Time) parts of the counter path above, but what about the instance name (_Total)? I cannot find this string in the registry, so I suppose that it is provided by whatever system component that provides the information.

Is the instance name for system provided performance counters guaranteed to be the same across different language versions of Windows?

If not, how can I determine which instance corresponds to the _Total instance?


Solution

  • According to this support KB, only the objects and counters have friendly names:

    However, instances do not have a user friendly name in each language.

    So this leads me to believe that instance names for a given counter are obtained either dynamically (e.g. ProcessId for a process) or statically (e.g. hard-coded). Of course there is nothing stopping somebody from hard-coding "_Total" in an English build and something else in a German build, though it seems the common practice is to keep the language stuff confined to the registry and deal with the objects and counters by index and the instances by dynamic or static names. I think Microsoft consistently uses "_Total" as I've seen it on a few foreign language installs.