<s > 元素<forcePerformanceCounterUniqueSharedMemoryReads> Element

指定 PerfCounter.dll 是否使用 .NET Framework 版本 1.1 应用程序中的 CategoryOptions 注册表设置,以确定是否加载来自特定于类别的共享内存或全局内存的性能计数器数据。Specifies whether PerfCounter.dll uses the CategoryOptions registry setting in a .NET Framework version 1.1 application to determine whether to load performance counter data from category-specific shared memory or global memory.

<configuration> <configuration>
    <runtime >   <runtime>
     <s >    <forcePerformanceCounterUniqueSharedMemoryReads>

语法Syntax

<forcePerformanceCounterUniqueSharedMemoryReads   
enabled="true|false"/>  

特性和元素Attributes and Elements

下列各节描述了特性、子元素和父元素。The following sections describe attributes, child elements, and parent elements.

特性Attributes

特性Attribute 描述Description
enabled 必需的特性。Required attribute.

指示 Perfcounter finish 是否使用 CategoryOptions 注册表设置来确定是否从特定于类别的共享内存或全局内存加载性能计数器数据。Indicates whether PerfCounter.dll uses the CategoryOptions registry setting to determine whether to load performance counter data from category-specific shared memory or global memory.

enabled 特性enabled Attribute

“值”Value 描述Description
false Perfcounter finish 不使用 CategoryOptions 注册表设置,这是默认设置。PerfCounter.dll does not use the CategoryOptions registry setting This is the default.
true Perfcounter finish 使用 CategoryOptions 注册表设置。PerfCounter.dll does use the CategoryOptions registry setting.

子元素Child Elements

无。None.

父元素Parent Elements

元素Element 描述Description
configuration 公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime 包含有关程序集绑定和垃圾回收的信息。Contains information about assembly binding and garbage collection.

备注Remarks

在 .NET Framework 4 之前的 .NET Framework 版本中,已加载到进程中加载的运行时的 Perfcounter finish 的版本。In versions of the .NET Framework before the .NET Framework 4, the version of PerfCounter.dll that was loaded corresponded to the runtime that was loaded in the process. 如果计算机已安装 .NET Framework 版本1.1 和 .NET Framework 2.0,.NET Framework 1.1 应用程序会加载 .NET Framework 1.1 版本的 Perfcounter finish。If a computer had both the .NET Framework version 1.1 and the .NET Framework 2.0 installed, a .NET Framework 1.1 application would load the .NET Framework 1.1 version of PerfCounter.dll. 从 .NET Framework 4 开始,将加载 Perfcounter finish 的最新安装版本。Starting with the .NET Framework 4, the newest installed version of PerfCounter.dll is loaded. 这意味着,如果计算机上安装了 .NET Framework 4 版本,.NET Framework 1.1 应用程序将加载 Perfcounter finish 的 .NET Framework 4 版本。This means that a .NET Framework 1.1 application will load the .NET Framework 4 version of PerfCounter.dll if the .NET Framework 4 is installed on the computer.

从 .NET Framework 4 开始,使用性能计数器时,Perfcounter finish 会检查每个提供程序的 CategoryOptions 注册表项,以确定是否应从特定于类别的共享内存或全局共享内存中读取。Starting with the .NET Framework 4, when consuming performance counters, PerfCounter.dll checks the CategoryOptions registry entry for each provider to determine whether it should read from category-specific shared memory or global shared memory. .NET Framework 1.1 Perfcounter finish 无法读取该注册表项,因为它不知道特定于类别的共享内存;它始终从全局共享内存进行读取。The .NET Framework 1.1 PerfCounter.dll does not read that registry entry, because it is not aware of category-specific shared memory; it always reads from global shared memory.

为实现向后兼容性,在 .NET Framework 1.1 应用程序中运行时,.NET Framework 4 Perfcounter finish 不检查 CategoryOptions 注册表项。For backward compatibility, the .NET Framework 4 PerfCounter.dll does not check the CategoryOptions registry entry when running in a .NET Framework 1.1 application. 它只使用全局共享内存,就像 .NET Framework 1.1 Perfcounter finish 一样。It simply uses global shared memory, just like the .NET Framework 1.1 PerfCounter.dll. 但是,可以通过启用 <forcePerformanceCounterUniqueSharedMemoryReads> 元素指示 .NET Framework 4 Perfcounter finish 检查注册表设置。However, you can instruct the .NET Framework 4 PerfCounter.dll to check the registry setting by enabling the <forcePerformanceCounterUniqueSharedMemoryReads> element.

备注

启用 <forcePerformanceCounterUniqueSharedMemoryReads> 元素不保证将使用特定于类别的共享内存。Enabling the <forcePerformanceCounterUniqueSharedMemoryReads> element does not guarantee that category-specific shared memory will be used. "启用" 设置为 "true 仅导致 Perfcounter finish 引用 CategoryOptions 注册表设置。Setting enabled to true only causes PerfCounter.dll to reference the CategoryOptions registry setting. CategoryOptions 的默认设置是使用特定于类别的共享内存;但是,您可以更改 CategoryOptions 以指示应使用全局共享内存。The default setting for CategoryOptions is to use category-specific shared memory; however, you can change CategoryOptions to indicate that global shared memory should be used.

包含 CategoryOptions 设置的注册表项为 HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\< 类别名称>\Performance。The registry key that contains the CategoryOptions setting is HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\<categoryName>\Performance. 默认情况下,CategoryOptions 设置为3,指示 Perfcounter finish 使用特定于类别的共享内存。By default, CategoryOptions is set to 3, which instructs PerfCounter.dll to use category-specific shared memory. 如果将 CategoryOptions 设置为0,则 Perfcounter finish 将使用全局共享内存。If CategoryOptions is set to 0, PerfCounter.dll uses global shared memory. 仅当正在创建的实例的名称与重复使用的实例相同时,才会重新使用实例数据。Instance data will be reused only if the name of the instance being created is identical to the instance being reused. 所有版本都可以写入该类别。All versions will be able to write to the category. 如果 CategoryOptions 设置为1,则使用全局共享内存,但如果类别名称与要重用的类别的长度相同,则可以重用实例数据。If CategoryOptions is set to 1, global shared memory is used, but instance data can be reused if the category name is the same length as the category being reused.

设置0和1可能会导致内存泄漏和填充性能计数器内存。The settings 0 and 1 can lead to memory leaks and the filling up of performance counter memory.

示例Example

下面的示例演示如何指定 Perfcounter finish 应引用 CategoryOptions 注册表项,以确定它是否应使用特定于类别的共享内存。The following example shows how to specify that PerfCounter.dll should reference the CategoryOptions registry entry to determine whether it should use category-specific shared memory.

<configuration>  
  <runtime>  
    <forcePerformanceCounterUniqueSharedMemoryReads enabled="true"/>  
  </runtime>  
</configuration>  

请参阅See also