d3drm: Implement GetVertices for IDirect3DRMMeshBuilder3.
[wine] / programs / taskmgr / perfdata.h
1 /*
2  *  ReactOS Task Manager
3  *
4  *  perfdata.h
5  *
6  *  Copyright (C) 1999 - 2001  Brian Palmer  <brianp@reactos.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22         
23 #ifndef __PERFDATA_H
24 #define __PERFDATA_H
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30
31 #if 0
32 typedef struct _TIME {
33         DWORD LowPart;
34         LONG HighPart;
35 } TIME, *PTIME;
36 #endif
37
38 typedef ULARGE_INTEGER  TIME, *PTIME;
39
40 typedef struct _UNICODE_STRING {
41     USHORT      Length;
42     USHORT      MaximumLength;
43     PWSTR       Buffer;
44 } UNICODE_STRING, *PUNICODE_STRING;
45
46 typedef struct _PERFDATA
47 {
48         WCHAR                           ImageName[MAX_PATH];
49         ULONG                           ProcessId;
50         WCHAR                           UserName[MAX_PATH];
51         ULONG                           SessionId;
52         ULONG                           CPUUsage;
53         TIME                            CPUTime;
54         ULONG                           WorkingSetSizeBytes;
55         ULONG                           PeakWorkingSetSizeBytes;
56         ULONG                           WorkingSetSizeDelta;
57         ULONG                           PageFaultCount;
58         ULONG                           PageFaultCountDelta;
59         ULONG                           VirtualMemorySizeBytes;
60         ULONG                           PagedPoolUsagePages;
61         ULONG                           NonPagedPoolUsagePages;
62         ULONG                           BasePriority;
63         ULONG                           HandleCount;
64         ULONG                           ThreadCount;
65         ULONG                           USERObjectCount;
66         ULONG                           GDIObjectCount;
67         IO_COUNTERS                     IOCounters;
68
69         TIME                            UserTime;
70         TIME                            KernelTime;
71 } PERFDATA, *PPERFDATA;
72
73 typedef struct _CLIENT_ID
74 {
75     HANDLE UniqueProcess;
76     HANDLE UniqueThread;
77 } CLIENT_ID, *PCLIENT_ID;
78
79 typedef enum _KWAIT_REASON
80 {
81    Executive,
82    FreePage,
83    PageIn,
84    PoolAllocation,
85    DelayExecution,
86    Suspended,
87    UserRequest,
88    WrExecutive,
89    WrFreePage,
90    WrPageIn,
91    WrDelayExecution,
92    WrSuspended,
93    WrUserRequest,
94    WrQueue,
95    WrLpcReceive,
96    WrLpcReply,
97    WrVirtualMemory,
98    WrPageOut,
99    WrRendezvous,
100    Spare2,
101    Spare3,
102    Spare4,
103    Spare5,
104    Spare6,
105    WrKernel,
106    MaximumWaitReason,
107 } KWAIT_REASON;
108
109 /* SystemProcessThreadInfo (5) */
110 typedef struct _SYSTEM_THREAD_INFORMATION
111 {
112         TIME            KernelTime;
113         TIME            UserTime;
114         TIME            CreateTime;
115         ULONG           TickCount;
116         ULONG           StartEIP;
117         CLIENT_ID       ClientId;
118         ULONG           DynamicPriority;
119         ULONG           BasePriority;
120         ULONG           nSwitches;
121         DWORD           State;
122         KWAIT_REASON    WaitReason;
123         
124 } SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION;
125
126 typedef struct SYSTEM_PROCESS_INFORMATION
127 {
128         ULONG                           RelativeOffset;
129         ULONG                           ThreadCount;
130         ULONG                           Unused1 [6];
131         TIME                            CreateTime;
132         TIME                            UserTime;
133         TIME                            KernelTime;
134         UNICODE_STRING          Name;
135         ULONG                           BasePriority;
136         ULONG                           ProcessId;
137         ULONG                           ParentProcessId;
138         ULONG                           HandleCount;
139         ULONG                           SessionId;
140         ULONG                           Unused2;
141         ULONG                           PeakVirtualSizeBytes;
142         ULONG                           TotalVirtualSizeBytes;
143         ULONG                           PageFaultCount;
144         ULONG                           PeakWorkingSetSizeBytes;
145         ULONG                           TotalWorkingSetSizeBytes;
146         ULONG                           PeakPagedPoolUsagePages;
147         ULONG                           TotalPagedPoolUsagePages;
148         ULONG                           PeakNonPagedPoolUsagePages;
149         ULONG                           TotalNonPagedPoolUsagePages;
150         ULONG                           TotalPageFileUsageBytes;
151         ULONG                           PeakPageFileUsageBytes;
152         ULONG                           TotalPrivateBytes;
153         SYSTEM_THREAD_INFORMATION       ThreadSysInfo [1];
154         
155 } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
156
157 typedef struct
158 {
159         DWORD   dwUnknown1;
160         ULONG   uKeMaximumIncrement;
161         ULONG   uPageSize;
162         ULONG   uMmNumberOfPhysicalPages;
163         ULONG   uMmLowestPhysicalPage;
164         ULONG   uMmHighestPhysicalPage;
165         ULONG   uAllocationGranularity;
166         PVOID   pLowestUserAddress;
167         PVOID   pMmHighestUserAddress;
168         ULONG   uKeActiveProcessors;
169         BYTE    bKeNumberProcessors;
170         BYTE    bUnknown2;
171         WORD    wUnknown3;
172 } SYSTEM_BASIC_INFORMATION;
173
174 /* SystemPerformanceInfo (2) */
175 typedef struct _SYSTEM_PERFORMANCE_INFORMATION
176 {
177         LARGE_INTEGER   /*TotalProcessorTime*/liIdleTime;
178         LARGE_INTEGER   IoReadTransferCount;
179         LARGE_INTEGER   IoWriteTransferCount;
180         LARGE_INTEGER   IoOtherTransferCount;
181         ULONG           IoReadOperationCount;
182         ULONG           IoWriteOperationCount;
183         ULONG           IoOtherOperationCount;
184         ULONG           MmAvailablePages;
185         ULONG           MmTotalCommittedPages;
186         ULONG           MmTotalCommitLimit;
187         ULONG           MmPeakLimit;
188         ULONG           PageFaults;
189         ULONG           WriteCopies;
190         ULONG           TransitionFaults;
191         ULONG           Unknown1;
192         ULONG           DemandZeroFaults;
193         ULONG           PagesInput;
194         ULONG           PagesRead;
195         ULONG           Unknown2;
196         ULONG           Unknown3;
197         ULONG           PagesOutput;
198         ULONG           PageWrites;
199         ULONG           Unknown4;
200         ULONG           Unknown5;
201         ULONG           PoolPagedBytes;
202         ULONG           PoolNonPagedBytes;
203         ULONG           Unknown6;
204         ULONG           Unknown7;
205         ULONG           Unknown8;
206         ULONG           Unknown9;
207         ULONG           MmTotalSystemFreePtes;
208         ULONG           MmSystemCodepage;
209         ULONG           MmTotalSystemDriverPages;
210         ULONG           MmTotalSystemCodePages;
211         ULONG           Unknown10;
212         ULONG           Unknown11;
213         ULONG           Unknown12;
214         ULONG           MmSystemCachePage;
215         ULONG           MmPagedPoolPage;
216         ULONG           MmSystemDriverPage;
217         ULONG           CcFastReadNoWait;
218         ULONG           CcFastReadWait;
219         ULONG           CcFastReadResourceMiss;
220         ULONG           CcFastReadNotPossible;
221         ULONG           CcFastMdlReadNoWait;
222         ULONG           CcFastMdlReadWait;
223         ULONG           CcFastMdlReadResourceMiss;
224         ULONG           CcFastMdlReadNotPossible;
225         ULONG           CcMapDataNoWait;
226         ULONG           CcMapDataWait;
227         ULONG           CcMapDataNoWaitMiss;
228         ULONG           CcMapDataWaitMiss;
229         ULONG           CcPinMappedDataCount;
230         ULONG           CcPinReadNoWait;
231         ULONG           CcPinReadWait;
232         ULONG           CcPinReadNoWaitMiss;
233         ULONG           CcPinReadWaitMiss;
234         ULONG           CcCopyReadNoWait;
235         ULONG           CcCopyReadWait;
236         ULONG           CcCopyReadNoWaitMiss;
237         ULONG           CcCopyReadWaitMiss;
238         ULONG           CcMdlReadNoWait;
239         ULONG           CcMdlReadWait;
240         ULONG           CcMdlReadNoWaitMiss;
241         ULONG           CcMdlReadWaitMiss;
242         ULONG           CcReadaheadIos;
243         ULONG           CcLazyWriteIos;
244         ULONG           CcLazyWritePages;
245         ULONG           CcDataFlushes;
246         ULONG           CcDataPages;
247         ULONG           ContextSwitches;
248         ULONG           Unknown13;
249         ULONG           Unknown14;
250         ULONG           SystemCalls;
251
252 } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
253
254 typedef struct
255 {
256         LARGE_INTEGER   liKeBootTime;
257         LARGE_INTEGER   liKeSystemTime;
258         LARGE_INTEGER   liExpTimeZoneBias;
259         ULONG                   uCurrentTimeZoneId;
260         DWORD                   dwReserved;
261 } SYSTEM_TIME_INFORMATION;
262
263 /* SystemCacheInformation (21) */
264 typedef struct _SYSTEM_CACHE_INFORMATION
265 {
266         ULONG   CurrentSize;
267         ULONG   PeakSize;
268         ULONG   PageFaultCount;
269         ULONG   MinimumWorkingSet;
270         ULONG   MaximumWorkingSet;
271         ULONG   Unused[4];
272
273 } SYSTEM_CACHE_INFORMATION;
274
275 /* SystemPageFileInformation (18) */
276 typedef
277 struct _SYSTEM_PAGEFILE_INFORMATION
278 {
279         ULONG           RelativeOffset;
280         ULONG           CurrentSizePages;
281         ULONG           TotalUsedPages;
282         ULONG           PeakUsedPages;
283         UNICODE_STRING  PagefileFileName;
284         
285 } SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION;
286
287 /* SystemHandleInformation (16) */
288 /* (see ontypes.h) */
289 typedef
290 struct _SYSTEM_HANDLE_ENTRY
291 {
292         ULONG   OwnerPid;
293         BYTE    ObjectType;
294         BYTE    HandleFlags;
295         USHORT  HandleValue;
296         PVOID   ObjectPointer;
297         ULONG   AccessMask;
298         
299 } SYSTEM_HANDLE_ENTRY, *PSYSTEM_HANDLE_ENTRY;
300
301 typedef
302 struct _SYSTEM_HANDLE_INFORMATION
303 {
304         ULONG                   Count;
305         SYSTEM_HANDLE_ENTRY     Handle [1];
306         
307 } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
308
309 /* SystemProcessorPerformanceInformation (8) */
310 typedef
311 struct _SYSTEM_PROCESSORTIME_INFO
312 {
313         LARGE_INTEGER   IdleTime;
314         LARGE_INTEGER   KernelTime;
315         LARGE_INTEGER   UserTime;
316         LARGE_INTEGER   DpcTime;
317         LARGE_INTEGER   InterruptTime;
318         ULONG                   InterruptCount;
319         ULONG                   Unused;
320         
321 } SYSTEM_PROCESSORTIME_INFO, *PSYSTEM_PROCESSORTIME_INFO;
322
323 #define SystemBasicInformation                  0
324 #define SystemPerformanceInformation    2
325 #define SystemTimeInformation                   3
326 #define SystemProcessInformation                5
327 #define SystemProcessorTimeInformation  8
328 #define SystemHandleInformation                 16
329 #define SystemPageFileInformation               18
330 #define SystemCacheInformation                  21
331
332 #define Li2Double(x) ((double)((x).QuadPart))
333
334 #define GR_GDIOBJECTS     0       /* Count of GDI objects */
335 #define GR_USEROBJECTS    1       /* Count of USER objects */
336
337 typedef LONG (WINAPI *PROCNTQSI)(UINT,PVOID,ULONG,PULONG); 
338 typedef DWORD (WINAPI *PROCGGR)(HANDLE,DWORD);
339 typedef BOOL (WINAPI *PROCGPIC)(HANDLE,PIO_COUNTERS);
340
341 BOOL    PerfDataInitialize(void);
342 void    PerfDataUninitialize(void);
343 void    PerfDataRefresh(void);
344
345 ULONG   PerfDataGetProcessCount(void);
346 ULONG   PerfDataGetProcessorUsage(void);
347 ULONG   PerfDataGetProcessorSystemUsage(void);
348
349 BOOL    PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, int nMaxCount);
350 ULONG   PerfDataGetProcessId(ULONG Index);
351 BOOL    PerfDataGetUserName(ULONG Index, LPWSTR lpUserName, int nMaxCount);
352 ULONG   PerfDataGetSessionId(ULONG Index);
353 ULONG   PerfDataGetCPUUsage(ULONG Index);
354 TIME    PerfDataGetCPUTime(ULONG Index);
355 ULONG   PerfDataGetWorkingSetSizeBytes(ULONG Index);
356 ULONG   PerfDataGetPeakWorkingSetSizeBytes(ULONG Index);
357 ULONG   PerfDataGetWorkingSetSizeDelta(ULONG Index);
358 ULONG   PerfDataGetPageFaultCount(ULONG Index);
359 ULONG   PerfDataGetPageFaultCountDelta(ULONG Index);
360 ULONG   PerfDataGetVirtualMemorySizeBytes(ULONG Index);
361 ULONG   PerfDataGetPagedPoolUsagePages(ULONG Index);
362 ULONG   PerfDataGetNonPagedPoolUsagePages(ULONG Index);
363 ULONG   PerfDataGetBasePriority(ULONG Index);
364 ULONG   PerfDataGetHandleCount(ULONG Index);
365 ULONG   PerfDataGetThreadCount(ULONG Index);
366 ULONG   PerfDataGetUSERObjectCount(ULONG Index);
367 ULONG   PerfDataGetGDIObjectCount(ULONG Index);
368 BOOL    PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters);
369
370 ULONG   PerfDataGetCommitChargeTotalK(void);
371 ULONG   PerfDataGetCommitChargeLimitK(void);
372 ULONG   PerfDataGetCommitChargePeakK(void);
373
374 ULONG   PerfDataGetKernelMemoryTotalK(void);
375 ULONG   PerfDataGetKernelMemoryPagedK(void);
376 ULONG   PerfDataGetKernelMemoryNonPagedK(void);
377
378 ULONG   PerfDataGetPhysicalMemoryTotalK(void);
379 ULONG   PerfDataGetPhysicalMemoryAvailableK(void);
380 ULONG   PerfDataGetPhysicalMemorySystemCacheK(void);
381
382 ULONG   PerfDataGetSystemHandleCount(void);
383
384 ULONG   PerfDataGetTotalThreadCount(void);
385
386
387 #ifdef __cplusplus
388 };
389 #endif
390
391 #endif /* __PERFDATA_H */