Creating the Performance DLL

An application's performance DLL defines the counter and object data structures that it uses to pass performance data to the performance monitor application. The DLL also provides up to three exported functions—Open, Collect, and Close— that are called by the Registry controller in response to requests from a performance monitoring program. The Collect function is required, while Open and Close are optional. Whichever ones you provide, be sure to export them in your .DEF file.

The prototypes for these functions, and the structures and constants used to define counters and counter objects, are defined in the WINPERF.H file distributed with the Windows NT Software Development Kit (SDK). For more information about using the structures and constants to define counters and counter objects, refer to Chapter 12 of this book, the comments in the WINPERF.H file, and to the SDK documentation on performance monitoring.

Table 13.4 Performance DLL Functions

Function

Description

Open

Initializes performance monitoring for the application

Collect

Reports performance data when requested

Close

Closes performance monitoring


When it is necessary to recompile the DLL during development, stop DLL performance monitoring between DLL changes. This is necessary because ADVAPI32.DLL and WINLOGON.EXE keep the old version open as long as you are monitoring.