Using Perfmon


Perfmon works by providing an infrastructure of objects, each of which can contain one or more counters. Thus, your application creates a new Perfmon object (this is the object that you can view from the Perfmon application) and then associates one or more counters with this object (the values of these counters are the values displayed by Perfmon).

The standard way to use Perfmon is to store your counters in your ISAPI DLL. Because this DLL is cross-application , it allows all areas of your application to update a common counter store. You should be careful of the consequences of putting a counter in your application DLL. If you put a counter in your application DLL, it will reset each time the DLL is unloaded (often after each request). This is rarely desirable.

ATL Server provides the following main classes for working with Perfmon:

  • CPerfObject : This class represents a Perfmon category. Examples include CPU, Processes, and Memory. Individual counters are defined via a map located in this class. It contains information such as the size of your object and an ID referring to your object, as well as a reference count and instance for your object. It also contains an offset from the beginning of the Perfmon object to the name of the instance.

  • CPerfMon : This class represents a manager object that manages a collection of categories. Each category is represented by a CPerfObject class (as described in the previous bulleted point). This class includes functionality such as registration, unregistration, initialization, and uninitialization, as well as creating and releasing the instance of your object ( CreateInstance and ReleaseInstance , respectively).

  • This class also provides functionality to make using Perfmon counters easy, such as opening and closing the connection to your counter, as well as adding categories and counters and collecting data from existing counters.

ATL Server s Perfmon support is also simplified through the use of attributes. You ll see the attributed code that helps you work with Perfmon later in this chapter.




ATL Server. High Performance C++ on. NET
Observing the User Experience: A Practitioners Guide to User Research
ISBN: B006Z372QQ
EAN: 2147483647
Year: 2002
Pages: 181

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net