Share via


DLL Interaction with a Performance Monitor Application (Windows CE 5.0)

Send Feedback

An application retrieves performance data by specifying HKEY_PERFORMANCE_DATA in a call to the RegQueryValueEx function. If successful, the RegQueryValueEx function fills a buffer of the application with the requested performance data.

The first time an application calls the RegQueryValueEx function, or if the application uses the RegOpenKey function to open HKEY_PERFORMANCE_DATA, the system calls the Open function for each application with matching registry entries.

This behavior gives each performance DLL an opportunity to initialize its performance data structures.

If the Open function returns successfully, or if there is no Open function, the system calls the Collect function. Subsequent calls to the RegQueryValueEx function cause the system to call the Collect function.

When the application finishes collecting performance data, it specifies HKEY_PERFORMANCE_DATA in a call to the RegCloseKey function. This causes the system to call the Close function for each application. The performance DLLs then unload.

Multiple programs can collect performance data at the same time, but the system calls the Open and Close functions only once for each application requesting performance data.

For remote measurement, the system limits access to these routines to one thread at a time, so synchronization is not a problem. However, for local measurement, because multiple processes might be making simultaneous calls, you must prevent conflicts from multiple concurrent requests for data.

When calling functions from within a performance DLL, ExitProcess, ExitThread, CreateThread, CreateRemoteThread, and a process that starts as the result of a call by CreateProcess are serialized within a process. In an address space, only one of these events can happen at any one time, and the following restrictions apply:

  • During process startup and DLL initialization routines, new threads can be created, but they do not begin execution until DLL initialization is finished for the process.
  • Only one thread at a time can be in a DLL initialization or detach routine.
  • The ExitProcess function does not return until no threads are in their DLL initialization or detach routines.

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.