Creating the Counter Definition Files

When you have chosen your counters, you need to create two files to define them: one is an .INI file and one is an .H file. This example uses the names MYGATE.INI and MYGATE.H. These files contain a numeric constant representing each counter, the name of each counter, and a help message describing what it does. The Windows NT Performance Monitor uses this information to display the counters and let the user select them.

MYGATE.H

MYGATE.H contains the defined numeric constants used to represent the counters. The names and help text for each counter are given in MYGATE.INI. These defined constants will be used to reference the counters inside your gateway as well as inside the Windows NT Performance Monitor.

MYGATE.H is a C/C++ include file that is intended to be included in your gateway program. It contains the symbol for the gateway object and each counter defined in the .INI file. Each symbol is assigned a constant numeric value. Note that each constant is a consecutive even number starting at 0. By convention, an even number represents the object or counter name and the odd number immediately following it represents the help text.

// begin MYGATE.H

#define MYGATE 0
#define MESSAGES_IN_OUT_QUEUE 2
#define BYTES_IN_OUT_QUEUE 4
#define MESSAGES_OUT 6
#define BYTES_OUT 8

// end MYGATE.H
 

MYGATE.INI

The .INI file contains three sections, [info], [languages], and [text]. The [info] section contains the name of the registry key used by the gateway, and the name of the .H file containing the numeric constants for each counter. The [languages] section contains numeric constants for each language used in the [text] section. The constants defined in this section, along with the “_HELP” and “_NAME” strings, are used to identify which strings in the [text] section correspond to which counters defined in the .H file. The [text] section contains the display names and help text for each counter. If multiple languages are defined in the [languages] section, display names and Help text for all such languages will be included in the [text] section.

// begin MYGATE.INI

[info]
drivername=MyGate
symbolfile=MYGATE.H

[languages]
009=English

[text]
MYGATE_009_NAME=My Gateway
MYGATE_009_HELP=This is my performance monitoring example
MESSAGES_IN_OUT_QUEUE_009_NAME=Messages In Outbound Queue
MESSAGES_IN_OUT_QUEUE_009_HELP=The number of messages in the outbound queue, waiting to be processed by the gateway
BYTES_IN_OUT_QUEUE_009_NAME=Bytes In Outbound Queue
BYTES_IN_OUT_QUEUE_009_HELP=The total bytes in the outbound queue, waiting to be processed by the gateway
MESSAGES_OUT_009_NAME=Outbound Messages
MESSAGES_OUT_009_HELP=The number of messages sent out of the gateway
BYTES_OUT_009_NAME=Outbound Bytes
BYTES_OUT_009_HELP=The total bytes sent out of the gateway

// end MYGATE.INI