The APIs defined in PM32_DLL.DLL are listed in Table 4 below.
Table 4: The PMON APIs
Category |
API |
Description |
Pmon32Init | Load/connect to the VxD. | |
Init | Pmon32InitEx | Load/connect to the VxD + Option to unload VxD on exit |
Pmon32Close | Close connection to DLL/VxD. Depending on how the DLL was initialized, this may or may not unload the VxD. | |
Pmon32InstallEvent | Install a new event into a
requested entry in the DLL event data base. This overrides
any existing entry. The table below shows the occupied events in the DLL data base. Pentium Pro Processor Events occupy entries from 0-81. Pentium Processor Events occupy entries from 0 - 61. It is advisable to add your events to the unoccupied entries. Both tables have 120 entries. |
|
Pmon32DisableRDPMCRing3 Pmon32EnableRDPMCRing3 | Allows/disables reading the counters from ring3. Only available on Pentium Processors with MMX Technology or Pentium Pro Processors. | |
Operation | Pmon32Start | Program the events, start counting |
Pmon32StartDirect | Send the value directly to the counter control registers. This also attaches strings to these events so that when these counters are stopped and the EventToStr routines are called, these strings will be returned. | |
Pmon32StartEx | Program the events, start counting. Additional support for Umask field. | |
Pmon32StopAndReadCounters | Stop counters, read results. | |
Status | Pmon32ReadCounters | Read counters on the fly. |
Pmon32ReadTSC | Read the time stamp counter. | |
Pmon32Status | Running/stopped, which events were or are being counted. | |
Pmon32AreCountersRunning | TRUE/FALSE for counters running. | |
Pmon32Event0ToStr Pmon32Event1ToStr | Returns a pointer to string for a given event index. |
The formal definitions for these APIs are (as included in the file DLL_IF.H):
DWORD (FAR *Pmon32Init) (struct Pmon32Version *ver);
DWORD (FAR *Pmon32Close) (void);
DWORD (FAR *Pmon32Status) (struct Pmon32Reply *Reply);
BOOL (FAR *Pmon32AreCountersRunning) ();
DWORD (FAR *Pmon32Start) (BYTE Event0, BYTE Event0Ring,
BYTE Event1, BYTE Event1Ring);
DWORD (FAR *Pmon32StopAndReadCounters) (struct Pmon32Reply *Reply);
DWORD (FAR *Pmon32ReadCounters) (struct Pmon32Reply *Reply);
DWORD (FAR *Pmon32ReadTSC) (struct Pmon32Reply *Reply);
DWORD (FAR *Pmon32EnableRDPMCRing3) (void);
DWORD (FAR *Pmon32DisableRDPMCRing3) (void);
char *(FAR *Pmon32Event0ToStr) (BYTE index);
char *(FAR *Pmon32Event1ToStr) (BYTE index);
DWORD (FAR *Pmon32StartEx) (struct Pmon32StartCmd *Cmd);
DWORD (FAR *Pmon32StartDirect) (DWORD E0, DWORD E1, char *str0,
char *str1);
DWORD (FAR *Pmon32InstallEvent) (BYTE Cnt, BYTE Index,
BYTE Encoding, BYTE Mask, char *str);
DWORD (FAR *Pmon32InitEx) (struct Pmon32StartCmd *Cmd, struct Pmon32Version *ver);
The application communicates with the DLL using the following structure:
struct Pmon32StartCmd{
BYTE Event0; // Index as defined by the table below (Section 9)
BYTE Event1; // Index as defined by the table below (Section 9)
BYTE Event0Ring; // 0 - ring 0, 3 - ring 3, 30 - ring 3 and 0
BYTE Event1Ring;
BYTE Event0Mask; // Only for Pentium Pro processors. As defined by the // architecture
BYTE Event1Mask;
BYTE Flg1; // res
BYTE Flg2; // res
BOOL unload_vxd_on_exit; // TRUE - VxD will be unloaded on exit
BOOL Flg3;
BOOL Flg4;
BOOL Flg5;
DWORD Res1;
DWORD Res2;
DWORD Res3;
};
struct Pmon32Reply{
DWORD T0_l; // Counter/event 0 LSB
DWORD T0_h; // Counter/event 0 LSB
DWORD T1_l; // Counter/event 1 MSB
DWORD T1_h; // Counter/event 1 MSB
DWORD TSC_l; // current Time Stamp LSB
DWORD TSC_h; // current Time Stamp MSB
DWORD ElapsedTime_l;
DWORD ElapsedTime_h;
DWORD TSCLast_l;
DWORD TSCLast_h;
BYTE Event0; // Index as known by the DLL
BYTE Event1;
BYTE Event0Ring;
BYTE Event1Ring;
BYTE Event0Mask;
BYTE Event1Mask;
BYTE pad1 ; // structure alignment
BYTE pad2 ;
DWORD status;
DWORD res1;
DWORD res2;
DWORD res3;
DWORD res4;
DWORD res5;
DWORD res6;
};
struct Pmon32Version{
char VxDVersion[32]; // A string
char DLLVersion[32]; // A string
int VxDMajor; // Represents the VxD major version number
int VxDMinor; // Represents the VxD minor version number
int DLLMajor; // Represents the DLL major version number
int DLLMinor; // Represents the DLL minor version number
char res2[16];
};
Table of Contents