系统性能计数器的实例名称是否已本地化? [英] Are instance names for system performance counters localized?

查看:36
本文介绍了系统性能计数器的实例名称是否已本地化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows 中的性能计数器名称是本地化的,因此例如计数器 \Processor(_Total)\% Processor Time 在其他语言版本的 Windows 中被称为其他名称.这意味着为了找到正确的名称,必须首先找到计数器的索引,然后使用 PdhLookupPerfNameByIndex 函数获取本地化名称(使用 PdhAddEnglishCounter 已失效.

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).

这对于上面计数器路径的性能对象 (Processor) 和计数器 (% Processor Time) 部分都很好,但是实例名称 (<代码>_Total)?我在注册表中找不到这个字符串,所以我想它是由提供信息的任何系统组件提供的.

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.

系统提供的性能计数器的实例名称是否保证在不同语言版本的 Windows 中相同?

如果不是,我如何确定哪个实例对应于 _Total 实例?

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

推荐答案

根据此支持知识库,只有对象和计数器有友好名称:

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.

所以这让我相信给定计数器的实例名称是动态(例如进程的 ProcessId)或静态(例如硬编码)获得的.当然,没有什么可以阻止某人在英语版本中对_Total"进行硬编码,在德语版本中使用其他东西,尽管通常的做法是将语言内容限制在注册表中,并通过以下方式处理对象和计数器索引和动态或静态名称的实例.我认为 Microsoft 一直使用_Total",正如我在一些外语安装中看到的那样.

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.

这篇关于系统性能计数器的实例名称是否已本地化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆