Microsoft KB Archive/270127

= INFO: Perflib Calling Close Procedure in Windows 2000 =

Article ID: 270127

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition
 * Microsoft Windows 2000 Datacenter Server

-



This article was previously published under Q270127



SUMMARY
The Performance Library (PerfLib), which is part of the Advapi32.dll file, calls the Close procedure of a Performance Service (for which the performance data has been collected before), if there is no collection/monitoring activity for 30 seconds, and if the monitoring application is interested in collecting some other performance objects/counters by object/counter name indexes.



Microsoft Windows NT 4.0

 * The Open procedure of a performance extension dynamic-link library (DLL) is called the first time whenever an application calls the RegQueryValueExA/W function for querying performance counters. For example, when the Performance Monitor is started and the counter's dialog box is selected, the Open procedure will be called once.
 * The Collect procedure of all performance extension DLLs is called regardless of the performance object/counter that is being monitored in Performance Monitor. For example, if an application calls RegQueryValueExA/W with &quot;Global&quot; or &quot;object name index's&quot;, the Collect procedure of all Performance Extension DLLs is called.
 * The Close procedure is called when RegCloseKey(HKEY_PERFORMANCE_DATA) is called.

Windows 2000
On a computer that is running Windows 2000, PerfLib has been redesigned and will call the Collect procedure of a Performance Extension DLL only when the following is true:
 * &quot;Global&quot; is queried. -or-


 * The Object List registry value is not exposed by the Performance Service. -or-


 * The object name index being queried exists in the Object List.

In addition, on a computer that is running Windows 2000, if a Performance Extension X.dll Collect procedure was called before and there is no longer a need to collect the performance data, the Close procedure will be called after PerfLib determines that there is no activity for collecting performance data from X.dll.

The Close procedure is called because the system does not want the performance service counter provider to generate performance data, even though no one is monitoring or needing performance counters that are implemented by that performance service. Therefore, if the monitoring application has deleted the performance object counters it collected before and is now only interested in monitoring/collecting some other counters, the Close procedure of all the previous Performance Services loaded will be called after an inactivity time out.

You can configure the time out in the following registry key by creating a REG_DWORD registry value that is named &quot;Library Unload Time&quot; and that specifies the unload time out in milliseconds:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib

The &quot;Library Unload Time&quot; registry value is global for all Performance Services.

Windows 2000 Perflib currently supports a REG_DWORD registry value that is named &quot;Keep Library Resident&quot; for each performance service in the following registry key:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\\Performance

XYZ is the performance service name.

If the &quot;Keep Library Resident&quot; registry value is set to 1, Perflib will completely disable the calling of the Close procedure because of a time out.

