PMON Features

Table 1 lists the features of PMON, which are described in detail below.

 

Feature User / Command line interface Programming/API interface
Event selection Yes Yes
Start/Stop counting Yes Yes
Delayed start Yes Yes (User implements)
Accumulate start Yes Yes (User implements)
Stop counting and log Yes Yes
Install new events Yes (events.ini) Yes
Read counters from ring3 Yes Yes
Send event directly to counters control registers No Yes

Table 1

 

Current Files and version numbers:

 

PM32_APP.exe The application - Version 2.2

PM32_DLL.dll The DLL - Version 2.2

PMON.vxd The VxD - Version 2.2

 

Warning: All version numbers must be as listed above or Pmon will not work correctly. You can check the DLL and VxD version numbers by looking at the first two lines in the Notification window. The utility checks the version numbers and displays a warning in the notification window if they do not match.

The VxD

The VxD is dynamically loaded the first time you activate the DLL and unloaded when you exit Windows.

Through the API or via the command line parameter you have the option to specify to unload the VxD after exiting PMON.

 When you use the PMON utility the VxD stays loaded by default. This enables the VxD to keep previous activation records and report them back later to the DLL. This way you can activate the tool from one application and stop it from another application and get the original activation event and data.

 The VxD is non intrusive. It is small, 7KB and is not active if you don’t call it. No interrupt chaining is used.

 

The DLL

The DLL implements a set of APIs and communicates with the VxD. It should be loaded by the application (using the PMON utility, or by loading it within the application code), and it is unloaded automatically when the last application that uses it exits.

 

The Utility Main features

Event Selection

You can select an event using the index drop-down list box or using the event drop-down list box. Choosing the first letter of the string will move the selection to the first event that starts with that letter. This will speed up the event selection.

When you exit, the last settings are saved in the pmon.ini file in the same directory as the Pmon Utility. These events are selected as the defaults when the Pmon Utility starts again, if the counters are not running. If counters are running at launch time, the Pmon Utility will display the current counter names and values and these will be written to the notification window.

 The variables used in event selection are (refer to Figure 3):  

Event: The name of the event being monitored.

Index: The index of the event as used by the Pmon Utility.

Umask: This drop-down list box exists only if the processor is Pentium Pro. The value here combines with the event value to select the actual event to count.

Ring: The privilege level of the events to be watched. 

 

 

Figure 3

  

The files associated with event selection are:

PMON.INI: Stores the last selected events and initializes the next instance of the Pmon Utility to these events.

EVENTS.INI: Modify this to add events not currently programmed into the Pmon Utility.

 

Start/Stop

Refer to Figure 3 for the following: 

Simple Start/Stop: Use this for immediate starting and stopping of the counters.

Start [Delay]: For a delayed start of the counters, first click on "Configuration" from the menu bar and then set the following parameters in the Configuration dialog box (see Figure 4):

  1. Delay after Start: Select the number of seconds to wait before starting the counters.
  2. Auto Stop After: You can select when you want to stop counting by entering the number of seconds here, or you can click on the simple Stop button to stop the counters immediately. 

Start [Accumulate]: A Windows timer is set to the requested interval and on each tick, it logs the counters values to a table in memory. The accuracy of this timer is at the mercy of the Windows OS and the running applications at that time. This might be okay as we are logging the cycles elapsed and most of the time we are interested in the difference between consecutive entries in the table. The results are written a file named trace.txt in the Pmon directory.

To use the Accumulate Start, first click on "Configuration" from the menu bar and then set the following parameters in the Configuration dialog box (see Figure 4):

  1. Number of Samples: Select the number of samples to take.
  2. Sampling Interval: Select the length of the interval between each sample (in milliseconds).
  3. Message window (optional): You can enter a descriptive line here to be written to trace.txt.

Stop message at the notification window: Refer to Figure 3. When counters are stopped the Pmon utility displays a summary of the last run in the notification window. The information provided is:

  1. The actual programmed hexadecimal values of the performance registers
  2. The event string and the event index that were chosen for counter 0 and counter 1
  3. The ring selection
  4. The counter values and the elapsed cycles from start to stop

 

 

 

Figure 4

Additional Settings

These settings are accessed by selecting the "Setting" option on the menu bar (see Figure 5).

 Auto Stop: Check this option to have the counters always auto stop after the time specified in the Configuration dialog box (see Figure 4).

 

 Figure 5

Always save results to file: Check this option to always have the counter data saved to a log file. The file will be named pmon32.log and it will be saved in the same directory as the Pmon Utility. If the file already exists, the new data will be appended to the end of the file.

Stay on top: Check here to keep the Pmon Utility always on top.

Save Selection to Clipboard: Highlight an area in the Notification window and then click here to have the area copied to the Windows clipboard.

Save Selection to FILE: Highlight an area in the Notification window and then click here to have the area copied to a file. The file name will be named trace.txt and it will be saved in the same directory as the Pmon Utility. If the file already exists, the new data will be appended to the end of the file.

 

Command Line Operation

Command Line Parameters

Table 2 lists the parameters that can be used with Pmon in the command line mode of operation.

Table 2: The Utility Command Line options

Command

Description

Example

/start Start the counters now /start
/T0=n

/T1=m

Specify the index for the event you want to activate. See Appendix A for the events and their indices. /T0=5

/T1=20

/T0CPL=x

/T1CPL=y

 

Set the ring level at which you want to count the events.

 

30 - level 012 and 3

3 - only level 3

0 - only level 0

/T0CPL=30 - counter 0 counts all relevant events if code runs in ring 0,1,2,3

 

/T1CPL=3 - counter 1 counts all relevant events if code runs in ring 3

/batch

 

Activate the utility without showing the GUI/interactive mode and exits at the end. The VxD will stay loaded after exit. /BATCH
/MSG=zzzyyyxxx Write this string to the log file as a reference. /MSG=Test20_Just_Before_Lunch
/STOP Stop the counter, read results and report /stop
/FILE=xyz.log When stopped, will log the results to this file (appended to the end) with regular date and time stamp. Note, no spaces around the equal sign /file=July23.log
/ACC_START Start counting and sample the counter every period of time (/INTERVAL). Put readings into a buffer. At the end write the whole table into a file-TRACE.TXT /ACC_START /SAMPLS=5000 INTERVAL=1000
/SAMPLES= Number of samples see above example
/INTERVAL= Sample rate [in ms] see above example
/DELAY_START Start counting after the delay. /DELAY_START /DELAY=5
/DELAY= Delay [sec] see above example

Note: The command line is not case sensitive.

 

 

Table 3 summarizes the parameters that are available with each mode of operation.

 

Table 3: Main Command line options Summary

Purpose /BATCH

 

/ACC_START

/INTERVAL=

/SAMPLES=

/START /STOP /DELAY_START

/DELAY=

/FILE=

/MSG=

Start & Exit

X

 

X

     
Stop & Exit

X

   

X

 

X

Start with Delay & Exit

X

     

X

 
Accumulate &

Exit

X

X

       

 

 

Command Line Examples

The following are examples of command lines.

1. pmon /t0=1 /T1=12 /t0cPl=30 /T1CPL=0 /StaRt /batch

description:

Timer 0 is selected with event #1 with level 0,1,2,3

Timer1 is selected with event #12 with level 0,1,2,

Start the timers now.

Don't show the pmon GUI, just exit at the end.

 

2. pmon32 /stop /file=log.log /msg= Test20_Just_Before_Lunch /batch

These are the results in the log.log file:

 

--------- Log xxx---------

Fri Sep 20 13:04:00 1996

CPU ID: Family= 5, Model= 2, Stepping= 11, FeatureFlags= 1BF

User Message: Test20_Just_Before_Lunch

Counter 0: 1294383

Counter 1: 11030874

Elapsed cycles (TSC): 11300

Cnt0 E: 02570243 Ring: 0 Mask0=00

Cnt1 E: 00000000 Ring: 0 Mask1=00

Event 0[4]: Data Read Miss

Event 1[23]:Instructions Executed in the v-pipe e.g. parallelism

--------- Log End------

Table of Contents
Chapter 6