<forcePerformanceCounterUniqueSharedMemoryReads > 元素<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>
<forcePerformanceCounterUniqueSharedMemoryReads><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.dll 是否使用 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.dll 不使用 CategoryOptions 注册表设置这是默认值。PerfCounter.dll does not use the CategoryOptions registry setting This is the default.
true PerfCounter.dll 确实使用的 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 版本.NET Framework 4.NET Framework 4,PerfCounter.dll 加载的版本对应于进程中加载的运行时。In versions of the .NET Framework before the .NET Framework 4.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 2.0安装,.NET Framework 1.1 应用程序将加载 PerfCounter.dll 的.NET Framework 1.1 版本。If a computer had both the .NET Framework version 1.1 and the .NET Framework 2.0.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.NET Framework 4,加载最新安装的 PerfCounter.dll 版本。Starting with the .NET Framework 4.NET Framework 4, the newest installed version of PerfCounter.dll is loaded. 这意味着.NET Framework 1.1 应用程序将加载.NET Framework 4.NET Framework 4PerfCounter.dll 版本如果.NET Framework 4.NET Framework 4的计算机上安装。This means that a .NET Framework 1.1 application will load the .NET Framework 4.NET Framework 4 version of PerfCounter.dll if the .NET Framework 4.NET Framework 4 is installed on the computer.

从开始.NET Framework 4.NET Framework 4,PerfCounter.dll 时使用性能计数器,检查每个提供程序,以确定是否应从特定于类别的共享的内存或全局共享的内存读取的 CategoryOptions 注册表项。Starting with the .NET Framework 4.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.dll 不读取该注册表项,因为它没有感知的特定于类别的共享内存;它始终从全局共享内存读取。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 4.NET Framework 4 PerfCounter.dll 在.NET Framework 1.1 应用程序中运行时不检查 CategoryOptions 注册表项。For backward compatibility, the .NET Framework 4.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.dll 一样。It simply uses global shared memory, just like the .NET Framework 1.1 PerfCounter.dll. 但是,您可以指示.NET Framework 4.NET Framework 4PerfCounter.dll 若要检查的注册表设置,从而<forcePerformanceCounterUniqueSharedMemoryReads>元素。However, you can instruct the .NET Framework 4.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.dll 要引用的 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\< categoryName>\Performance。The registry key that contains the CategoryOptions setting is HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\<categoryName>\Performance. 默认情况下,CategoryOptions 设置为 3,它指示 PerfCounter.dll 为使用特定于类别的共享的内存。By default, CategoryOptions is set to 3, which instructs PerfCounter.dll to use category-specific shared memory. 如果 CategoryOptions 设置为 0,PerfCounter.dll 使用全局共享的内存。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.dll 应引用 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