1 /***********************************************************************\
2 *                               winperf.d                               *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                                                                       *
8 *                       Placed into public domain                       *
9 \***********************************************************************/
10 module win32.winperf;
11 
12 import win32.windef;
13 import win32.winbase; // for SYSTEMTIME
14 
15 const PERF_DATA_VERSION=1;
16 const PERF_DATA_REVISION=1;
17 const PERF_NO_INSTANCES=-1;
18 const PERF_SIZE_DWORD=0;
19 const PERF_SIZE_LARGE=256;
20 const PERF_SIZE_ZERO=512;
21 const PERF_SIZE_VARIABLE_LEN=768;
22 const PERF_TYPE_NUMBER=0;
23 const PERF_TYPE_COUNTER=1024;
24 const PERF_TYPE_TEXT=2048;
25 const PERF_TYPE_ZERO=0xC00;
26 const PERF_NUMBER_HEX=0;
27 const PERF_NUMBER_DECIMAL=0x10000;
28 const PERF_NUMBER_DEC_1000=0x20000;
29 const PERF_COUNTER_VALUE=0;
30 const PERF_COUNTER_RATE=0x10000;
31 const PERF_COUNTER_FRACTION=0x20000;
32 const PERF_COUNTER_BASE=0x30000;
33 const PERF_COUNTER_ELAPSED=0x40000;
34 const PERF_COUNTER_QUEUELEN=0x50000;
35 const PERF_COUNTER_HISTOGRAM=0x60000;
36 const PERF_TEXT_UNICODE=0;
37 const PERF_TEXT_ASCII=0x10000;
38 const PERF_TIMER_TICK=0;
39 const PERF_TIMER_100NS=0x100000;
40 const PERF_OBJECT_TIMER=0x200000;
41 const PERF_DELTA_COUNTER=0x400000;
42 const PERF_DELTA_BASE=0x800000;
43 const PERF_INVERSE_COUNTER=0x1000000;
44 const PERF_MULTI_COUNTER=0x2000000;
45 const PERF_DISPLAY_NO_SUFFIX=0;
46 const PERF_DISPLAY_PER_SEC=0x10000000;
47 const PERF_DISPLAY_PERCENT=0x20000000;
48 const PERF_DISPLAY_SECONDS=0x30000000;
49 const PERF_DISPLAY_NOSHOW=0x40000000;
50 const PERF_COUNTER_HISTOGRAM_TYPE=0x80000000;
51 const PERF_NO_UNIQUE_ID=(-1);
52 const PERF_DETAIL_NOVICE=100;
53 const PERF_DETAIL_ADVANCED=200;
54 const PERF_DETAIL_EXPERT=300;
55 const PERF_DETAIL_WIZARD=400;
56 const PERF_COUNTER_COUNTER=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_TICK|PERF_DELTA_COUNTER|PERF_DISPLAY_PER_SEC);
57 const PERF_COUNTER_TIMER=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_TICK|PERF_DELTA_COUNTER|PERF_DISPLAY_PERCENT);
58 const PERF_COUNTER_QUEUELEN_TYPE=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_QUEUELEN|PERF_TIMER_TICK|PERF_DELTA_COUNTER|PERF_DISPLAY_NO_SUFFIX);
59 const PERF_COUNTER_BULK_COUNT=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_TICK|PERF_DELTA_COUNTER|PERF_DISPLAY_PER_SEC);
60 const PERF_COUNTER_TEXT=(PERF_SIZE_VARIABLE_LEN|PERF_TYPE_TEXT|PERF_TEXT_UNICODE|PERF_DISPLAY_NO_SUFFIX);
61 const PERF_COUNTER_RAWCOUNT=(PERF_SIZE_DWORD|PERF_TYPE_NUMBER|PERF_NUMBER_DECIMAL|PERF_DISPLAY_NO_SUFFIX);
62 const PERF_COUNTER_LARGE_RAWCOUNT=(PERF_SIZE_LARGE|PERF_TYPE_NUMBER|PERF_NUMBER_DECIMAL|PERF_DISPLAY_NO_SUFFIX);
63 const PERF_COUNTER_RAWCOUNT_HEX=(PERF_SIZE_DWORD|PERF_TYPE_NUMBER|PERF_NUMBER_HEX|PERF_DISPLAY_NO_SUFFIX);
64 const PERF_COUNTER_LARGE_RAWCOUNT_HEX=(PERF_SIZE_LARGE|PERF_TYPE_NUMBER|PERF_NUMBER_HEX|PERF_DISPLAY_NO_SUFFIX);
65 const PERF_SAMPLE_FRACTION=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_FRACTION|PERF_DELTA_COUNTER|PERF_DELTA_BASE|PERF_DISPLAY_PERCENT);
66 const PERF_SAMPLE_COUNTER=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_TICK|PERF_DELTA_COUNTER|PERF_DISPLAY_NO_SUFFIX);
67 const PERF_COUNTER_NODATA=(PERF_SIZE_ZERO|PERF_DISPLAY_NOSHOW);
68 const PERF_COUNTER_TIMER_INV=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_TICK|PERF_DELTA_COUNTER|PERF_INVERSE_COUNTER|PERF_DISPLAY_PERCENT);
69 const PERF_SAMPLE_BASE=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_BASE|PERF_DISPLAY_NOSHOW|1);
70 const PERF_AVERAGE_TIMER=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_FRACTION|PERF_DISPLAY_SECONDS);
71 const PERF_AVERAGE_BASE=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_BASE|PERF_DISPLAY_NOSHOW|2);
72 const PERF_AVERAGE_BULK=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_FRACTION|PERF_DISPLAY_NOSHOW);
73 const PERF_100NSEC_TIMER=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_100NS|PERF_DELTA_COUNTER|PERF_DISPLAY_PERCENT);
74 const PERF_100NSEC_TIMER_INV=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_100NS|PERF_DELTA_COUNTER|PERF_INVERSE_COUNTER|PERF_DISPLAY_PERCENT);
75 const PERF_COUNTER_MULTI_TIMER=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_DELTA_COUNTER|PERF_TIMER_TICK|PERF_MULTI_COUNTER|PERF_DISPLAY_PERCENT);
76 const PERF_COUNTER_MULTI_TIMER_INV=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_DELTA_COUNTER|PERF_MULTI_COUNTER|PERF_TIMER_TICK|PERF_INVERSE_COUNTER|PERF_DISPLAY_PERCENT);
77 const PERF_COUNTER_MULTI_BASE=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_BASE|PERF_MULTI_COUNTER|PERF_DISPLAY_NOSHOW);
78 const PERF_100NSEC_MULTI_TIMER=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_DELTA_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_100NS|PERF_MULTI_COUNTER|PERF_DISPLAY_PERCENT);
79 const PERF_100NSEC_MULTI_TIMER_INV=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_DELTA_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_100NS|PERF_MULTI_COUNTER|PERF_INVERSE_COUNTER|PERF_DISPLAY_PERCENT);
80 const PERF_RAW_FRACTION=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_FRACTION|PERF_DISPLAY_PERCENT);
81 const PERF_RAW_BASE=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_BASE|PERF_DISPLAY_NOSHOW|3);
82 const PERF_ELAPSED_TIME=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_ELAPSED|PERF_OBJECT_TIMER|PERF_DISPLAY_SECONDS);
83 
84 struct PERF_DATA_BLOCK {
85 	WCHAR Signature[4];
86 	DWORD LittleEndian;
87 	DWORD Version;
88 	DWORD Revision;
89 	DWORD TotalByteLength;
90 	DWORD HeaderLength;
91 	DWORD NumObjectTypes;
92 	LONG DefaultObject;
93 	SYSTEMTIME SystemTime;
94 	LARGE_INTEGER PerfTime;
95 	LARGE_INTEGER PerfFreq;
96 	LARGE_INTEGER PerfTime100nSec;
97 	DWORD SystemNameLength;
98 	DWORD SystemNameOffset;
99 }
100 alias PERF_DATA_BLOCK * PPERF_DATA_BLOCK;
101 
102 struct PERF_OBJECT_TYPE {
103 	DWORD TotalByteLength;
104 	DWORD DefinitionLength;
105 	DWORD HeaderLength;
106 	DWORD ObjectNameTitleIndex;
107 	LPWSTR ObjectNameTitle;
108 	DWORD ObjectHelpTitleIndex;
109 	LPWSTR ObjectHelpTitle;
110 	DWORD DetailLevel;
111 	DWORD NumCounters;
112 	LONG DefaultCounter;
113 	LONG NumInstances;
114 	DWORD CodePage;
115 	LARGE_INTEGER PerfTime;
116 	LARGE_INTEGER PerfFreq;
117 }
118 alias PERF_OBJECT_TYPE * PPERF_OBJECT_TYPE;
119 
120 struct PERF_COUNTER_DEFINITION {
121 	DWORD ByteLength;
122 	DWORD CounterNameTitleIndex;
123 	LPWSTR CounterNameTitle;
124 	DWORD CounterHelpTitleIndex;
125 	LPWSTR CounterHelpTitle;
126 	LONG DefaultScale;
127 	DWORD DetailLevel;
128 	DWORD CounterType;
129 	DWORD CounterSize;
130 	DWORD CounterOffset;
131 }
132 alias PERF_COUNTER_DEFINITION * PPERF_COUNTER_DEFINITION;
133 
134 struct PERF_INSTANCE_DEFINITION {
135 	DWORD ByteLength;
136 	DWORD ParentObjectTitleIndex;
137 	DWORD ParentObjectInstance;
138 	LONG UniqueID;
139 	DWORD NameOffset;
140 	DWORD NameLength;
141 }
142 alias PERF_INSTANCE_DEFINITION * PPERF_INSTANCE_DEFINITION;
143 
144 struct PERF_COUNTER_BLOCK {
145 	DWORD ByteLength;
146 }
147 alias PERF_COUNTER_BLOCK * PPERF_COUNTER_BLOCK;
148 
149 extern (Windows):
150 alias DWORD function (LPWSTR) PM_OPEN_PROC;
151 alias DWORD function (LPWSTR,PVOID*,PDWORD,PDWORD) PM_COLLECT_PROC;
152 alias DWORD function () PM_CLOSE_PROC;