|
|
1.1 root 1: Using the VGA performance counters example
2:
3: Overview:
4:
5: This example is provided as a supplement to the VGA driver provided in
6: the DDK to demonstrate the addition of performance counters to a device
7: driver. The counter example will count the VGA driver's TextOut and
8: BitBlt operations and provide this data to the performance section of the
9: registry by way of the VGACTRS.DLL. The easiest way to see these counters
10: is by running Perfmon after they have been installed.
11:
12: Building and Installing:
13:
14: Before working with this sample, please refer to the DDK Programmer's Guide
15: for more details on performance counters.
16:
17: 1. Design the counter objects and counter names for the driver.
18: One driver may have multiple counter objects, counters and
19: instances of counter objects as is appropriate. See Perfmon's
20: counters for examples of each of these cases.
21:
22: (This step has already been accomplished)
23:
24:
25: 2. Create the driver name installation file and include file.
26:
27: These are the example files:
28:
29: vgactrs\vgactrnm.h ; include file for counter offsets
30: vgactrs\vgactrs.ini ; name and explain texd definitions
31:
32: 3. Add data collection functions, variables and interfaces to the
33: device driver (see "tips" below).
34:
35: Replace the following files in the VGA driver example with
36: these files and re-build the VGA.DLL file. Replace the current
37: VGA.DLL in the system32 directory with this one.
38:
39: vgacode\driver\enable.c ; interface initialization code
40: vgacode\driver\bitblt.c ; bitblt counter increment
41: vgacode\driver\textout.c ; textout counter increment
42:
43: 4. Create the Counter DLL routines (Open, Collect and Close) and
44: any requisite data structures (see "tips" below).
45:
46: Build the vgactrs directory which will produce the vgactrs.dll
47: and copy the .dll into the system32 directory.
48:
49: 5. Update the registry entries. For testing this can be done
50: manually, however, for "production", these modifications should
51: be done by Setup when the driver and the counter DLL's are
52: installed. The registry entries include AT LEAST:
53:
54: For loading of your driver's performance counter
55: DLL and routines, make the following modifications
56: to the registry using regedt32:
57:
58: MACHINE
59: SYSTEM
60: CurrentControlSet
61: Services
62: VGA
63: Performance
64: :Library=vgactrs.dll
65: :Open=OpenVgaPerformanceData
66: :Collect=CollectVgaPerformanceData
67: :Close=CloseVgaPerformanceData
68:
69: For the event logger to recognize your driver's
70: error messages and display the corresponding text,
71: make the following modifications to the registry using
72: regedt32:
73:
74: MACHINE
75: SYSTEM
76: CurrentControlSet
77: Services
78: EventLog
79: Application
80: VgaCtrs
81: :EventMessageFile=
82: %systemroot%\system32\vgactrs.dll
83: :TypesSupported=0x07
84:
85:
86: 6. Load the counter names and explain text into the registry
87: using the LODCTR utility and the corresponding .INI file.
88:
89: > lodctr vgactrs.ini
90:
91: At this point all the software is installed and the system will need to be
92: rebooted for the changes to take effect (more specifically for the new
93: VGA driver and counter .DLL to be loaded).
94:
95: Be sure to reboot between VGACTRS.DLL changes if it is necessary to
96: recompile the Counter DLL since SCREG.EXE will keep the old version
97: opened until the system is rebooted.
98:
99:
100: List of files supplied in this example:
101:
102: README.TXT
103: this file.
104:
105: VGACODE
106: directory of modified VGA driver files. These files should replace
107: the corresponding files in the VGA driver example in order to build
108: a VGA driver that provides performance statistics.
109:
110: \enable.c
111: modified VGA file that contains the initialization of a mapped
112: memory section for use by the VGACTRS.DLL to read the values of
113: the performance counters collected by the VGA driver.
114:
115: \bitblt.c
116: modified VGA file that increments the bitblt counter every time
117: the bitblt routine is called
118:
119: \textout.c
120: modified VGA file that increments the textout counter every time
121: the textout routine is called.
122:
123: VGACTRS
124: the directory containing the extensible performance counter routines
125: and initialization files for the VGA driver counters.
126:
127: \datavga.h
128: data structure and offset constant definitions for the data
129: block returned to the registry by the VGA extensible counter
130: routines.
131:
132: \datavga.c
133: the declaration and initialization of the static data template
134: used to format the counter data for return to the registry
135:
136: \makefile
137: the generic makefile used to build the example code.
138:
139: \makefile.inc
140: the addition to the standard makefile that compiles the
141: message file when necessary
142:
143: \perfmsg.h
144: macros and constants used for formatting and passing messages
145: to the event logging facility
146:
147: \perfutil.c
148: utility routines used by the counter functions
149:
150: \perfutil.h
151: utility routine prototypes and constant defintions used by the
152: counter routines.
153:
154: \perfvga.c
155: Counter routines used by the registry to open and collect data
156: from the VGA driver.
157:
158: \sources
159: list of files and environment variables to use when compiling
160: source code
161:
162: \vgactrnm.h
163: symbolic constants used by extensible counter routines and
164: registry initialization files that indicate the relative value
165: of the counter and object names and explain text.
166:
167: \vgactrs.mc
168: message definition file for logging error events to the event
169: logger
170:
171: \vgactrs.ini
172: explain text and counter name definition file used by lodctr
173: utility to add these entries to the registry.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.