<forcePerformanceCounterUniqueSharedMemoryReads> Element<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>
     <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.

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

Value 描述Description
false PerfCounter.dll does not use the CategoryOptions registry setting This is the default.PerfCounter.dll does not use the CategoryOptions registry setting This is the default.
true PerfCounter.dll does use the CategoryOptions registry setting.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

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.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. 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.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. Starting with the .NET Framework 4, the newest installed version of PerfCounter.dll is loaded.Starting with the .NET Framework 4, the newest installed version of PerfCounter.dll is loaded. 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.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.

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

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.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。It simply uses global shared memory, just like the .NET Framework 1.1 PerfCounter.dll. 不過,您可以藉由啟用 <forcePerformanceCounterUniqueSharedMemoryReads> 元素,指示 .NET Framework 4 PerfCounter 檢查登錄設定。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 參考 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 使用類別特定的共用記憶體。By default, CategoryOptions is set to 3, which instructs PerfCounter.dll to use category-specific shared memory. 如果 CategoryOptions 設定為0,則 PerfCounter 會使用全域共用記憶體。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 應該參考 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