1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW Windows headers
5  *
6  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
7  * Source: $(DRUNTIMESRC core/sys/windows/_winperf.d)
8  */
9 module core.sys.windows.winperf;
10 version (Windows):
11 
12 import core.sys.windows.windef;
13 import core.sys.windows.winbase; // for SYSTEMTIME
14 
15 enum PERF_DATA_VERSION=1;
16 enum PERF_DATA_REVISION=1;
17 enum PERF_NO_INSTANCES=-1;
18 enum PERF_SIZE_DWORD=0;
19 enum PERF_SIZE_LARGE=256;
20 enum PERF_SIZE_ZERO=512;
21 enum PERF_SIZE_VARIABLE_LEN=768;
22 enum PERF_TYPE_NUMBER=0;
23 enum PERF_TYPE_COUNTER=1024;
24 enum PERF_TYPE_TEXT=2048;
25 enum PERF_TYPE_ZERO=0xC00;
26 enum PERF_NUMBER_HEX=0;
27 enum PERF_NUMBER_DECIMAL=0x10000;
28 enum PERF_NUMBER_DEC_1000=0x20000;
29 enum PERF_COUNTER_VALUE=0;
30 enum PERF_COUNTER_RATE=0x10000;
31 enum PERF_COUNTER_FRACTION=0x20000;
32 enum PERF_COUNTER_BASE=0x30000;
33 enum PERF_COUNTER_ELAPSED=0x40000;
34 enum PERF_COUNTER_QUEUELEN=0x50000;
35 enum PERF_COUNTER_HISTOGRAM=0x60000;
36 enum PERF_TEXT_UNICODE=0;
37 enum PERF_TEXT_ASCII=0x10000;
38 enum PERF_TIMER_TICK=0;
39 enum PERF_TIMER_100NS=0x100000;
40 enum PERF_OBJECT_TIMER=0x200000;
41 enum PERF_DELTA_COUNTER=0x400000;
42 enum PERF_DELTA_BASE=0x800000;
43 enum PERF_INVERSE_COUNTER=0x1000000;
44 enum PERF_MULTI_COUNTER=0x2000000;
45 enum PERF_DISPLAY_NO_SUFFIX=0;
46 enum PERF_DISPLAY_PER_SEC=0x10000000;
47 enum PERF_DISPLAY_PERCENT=0x20000000;
48 enum PERF_DISPLAY_SECONDS=0x30000000;
49 enum PERF_DISPLAY_NOSHOW=0x40000000;
50 enum PERF_COUNTER_HISTOGRAM_TYPE=0x80000000;
51 enum PERF_NO_UNIQUE_ID=(-1);
52 enum PERF_DETAIL_NOVICE=100;
53 enum PERF_DETAIL_ADVANCED=200;
54 enum PERF_DETAIL_EXPERT=300;
55 enum PERF_DETAIL_WIZARD=400;
56 enum PERF_COUNTER_COUNTER=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_TICK|PERF_DELTA_COUNTER|PERF_DISPLAY_PER_SEC);
57 enum PERF_COUNTER_TIMER=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_TICK|PERF_DELTA_COUNTER|PERF_DISPLAY_PERCENT);
58 enum PERF_COUNTER_QUEUELEN_TYPE=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_QUEUELEN|PERF_TIMER_TICK|PERF_DELTA_COUNTER|PERF_DISPLAY_NO_SUFFIX);
59 enum PERF_COUNTER_BULK_COUNT=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_TICK|PERF_DELTA_COUNTER|PERF_DISPLAY_PER_SEC);
60 enum PERF_COUNTER_TEXT=(PERF_SIZE_VARIABLE_LEN|PERF_TYPE_TEXT|PERF_TEXT_UNICODE|PERF_DISPLAY_NO_SUFFIX);
61 enum PERF_COUNTER_RAWCOUNT=(PERF_SIZE_DWORD|PERF_TYPE_NUMBER|PERF_NUMBER_DECIMAL|PERF_DISPLAY_NO_SUFFIX);
62 enum PERF_COUNTER_LARGE_RAWCOUNT=(PERF_SIZE_LARGE|PERF_TYPE_NUMBER|PERF_NUMBER_DECIMAL|PERF_DISPLAY_NO_SUFFIX);
63 enum PERF_COUNTER_RAWCOUNT_HEX=(PERF_SIZE_DWORD|PERF_TYPE_NUMBER|PERF_NUMBER_HEX|PERF_DISPLAY_NO_SUFFIX);
64 enum PERF_COUNTER_LARGE_RAWCOUNT_HEX=(PERF_SIZE_LARGE|PERF_TYPE_NUMBER|PERF_NUMBER_HEX|PERF_DISPLAY_NO_SUFFIX);
65 enum PERF_SAMPLE_FRACTION=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_FRACTION|PERF_DELTA_COUNTER|PERF_DELTA_BASE|PERF_DISPLAY_PERCENT);
66 enum PERF_SAMPLE_COUNTER=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_TICK|PERF_DELTA_COUNTER|PERF_DISPLAY_NO_SUFFIX);
67 enum PERF_COUNTER_NODATA=(PERF_SIZE_ZERO|PERF_DISPLAY_NOSHOW);
68 enum 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 enum PERF_SAMPLE_BASE=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_BASE|PERF_DISPLAY_NOSHOW|1);
70 enum PERF_AVERAGE_TIMER=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_FRACTION|PERF_DISPLAY_SECONDS);
71 enum PERF_AVERAGE_BASE=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_BASE|PERF_DISPLAY_NOSHOW|2);
72 enum PERF_AVERAGE_BULK=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_FRACTION|PERF_DISPLAY_NOSHOW);
73 enum PERF_100NSEC_TIMER=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_RATE|PERF_TIMER_100NS|PERF_DELTA_COUNTER|PERF_DISPLAY_PERCENT);
74 enum 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 enum 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 enum 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 enum PERF_COUNTER_MULTI_BASE=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_BASE|PERF_MULTI_COUNTER|PERF_DISPLAY_NOSHOW);
78 enum 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 enum 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 enum PERF_RAW_FRACTION=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_FRACTION|PERF_DISPLAY_PERCENT);
81 enum PERF_RAW_BASE=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_BASE|PERF_DISPLAY_NOSHOW|3);
82 enum 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[4] Signature = 0;
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 version (Win64) {
108     DWORD ObjectNameTitle;
109 } else {
110     LPWSTR ObjectNameTitle;
111 }
112     DWORD ObjectHelpTitleIndex;
113 version (Win64) {
114     DWORD ObjectHelpTitle;
115 } else {
116     LPWSTR ObjectHelpTitle;
117 }
118     DWORD DetailLevel;
119     DWORD NumCounters;
120     LONG DefaultCounter;
121     LONG NumInstances;
122     DWORD CodePage;
123     LARGE_INTEGER PerfTime;
124     LARGE_INTEGER PerfFreq;
125 }
126 alias PERF_OBJECT_TYPE * PPERF_OBJECT_TYPE;
127 
128 struct PERF_COUNTER_DEFINITION {
129     DWORD ByteLength;
130     DWORD CounterNameTitleIndex;
131 version (Win64) {
132     DWORD CounterNameTitle;
133 } else {
134     LPWSTR CounterNameTitle;
135 }
136     DWORD CounterHelpTitleIndex;
137 version (Win64) {
138     DWORD CounterHelpTitle;
139 } else {
140     LPWSTR CounterHelpTitle;
141 }
142     LONG DefaultScale;
143     DWORD DetailLevel;
144     DWORD CounterType;
145     DWORD CounterSize;
146     DWORD CounterOffset;
147 }
148 alias PERF_COUNTER_DEFINITION * PPERF_COUNTER_DEFINITION;
149 
150 struct PERF_INSTANCE_DEFINITION {
151     DWORD ByteLength;
152     DWORD ParentObjectTitleIndex;
153     DWORD ParentObjectInstance;
154     LONG UniqueID;
155     DWORD NameOffset;
156     DWORD NameLength;
157 }
158 alias PERF_INSTANCE_DEFINITION * PPERF_INSTANCE_DEFINITION;
159 
160 struct PERF_COUNTER_BLOCK {
161     DWORD ByteLength;
162 }
163 alias PERF_COUNTER_BLOCK * PPERF_COUNTER_BLOCK;
164 
165 extern (Windows):
166 alias DWORD function (LPWSTR) PM_OPEN_PROC;
167 alias DWORD function (LPWSTR,PVOID*,PDWORD,PDWORD) PM_COLLECT_PROC;
168 alias DWORD function () PM_CLOSE_PROC;