6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
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.
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.
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
32 typedef struct _TIME {
38 typedef ULARGE_INTEGER TIME, *PTIME;
40 typedef struct _UNICODE_STRING {
44 } UNICODE_STRING, *PUNICODE_STRING;
46 typedef struct _PERFDATA
48 WCHAR ImageName[MAX_PATH];
50 WCHAR UserName[MAX_PATH];
54 ULONG WorkingSetSizeBytes;
55 ULONG PeakWorkingSetSizeBytes;
56 ULONG WorkingSetSizeDelta;
58 ULONG PageFaultCountDelta;
59 ULONG VirtualMemorySizeBytes;
60 ULONG PagedPoolUsagePages;
61 ULONG NonPagedPoolUsagePages;
65 ULONG USERObjectCount;
67 IO_COUNTERS IOCounters;
71 } PERFDATA, *PPERFDATA;
73 typedef struct _CLIENT_ID
77 } CLIENT_ID, *PCLIENT_ID;
79 typedef enum _KWAIT_REASON
109 /* SystemProcessThreadInfo (5) */
110 typedef struct _SYSTEM_THREAD_INFORMATION
118 ULONG DynamicPriority;
122 KWAIT_REASON WaitReason;
124 } SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION;
126 typedef struct SYSTEM_PROCESS_INFORMATION
128 ULONG RelativeOffset;
137 ULONG ParentProcessId;
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];
155 } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
160 ULONG uKeMaximumIncrement;
162 ULONG uMmNumberOfPhysicalPages;
163 ULONG uMmLowestPhysicalPage;
164 ULONG uMmHighestPhysicalPage;
165 ULONG uAllocationGranularity;
166 PVOID pLowestUserAddress;
167 PVOID pMmHighestUserAddress;
168 ULONG uKeActiveProcessors;
169 BYTE bKeNumberProcessors;
172 } SYSTEM_BASIC_INFORMATION;
174 /* SystemPerformanceInfo (2) */
175 typedef struct _SYSTEM_PERFORMANCE_INFORMATION
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;
190 ULONG TransitionFaults;
192 ULONG DemandZeroFaults;
201 ULONG PoolPagedBytes;
202 ULONG PoolNonPagedBytes;
207 ULONG MmTotalSystemFreePtes;
208 ULONG MmSystemCodepage;
209 ULONG MmTotalSystemDriverPages;
210 ULONG MmTotalSystemCodePages;
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;
227 ULONG CcMapDataNoWaitMiss;
228 ULONG CcMapDataWaitMiss;
229 ULONG CcPinMappedDataCount;
230 ULONG CcPinReadNoWait;
232 ULONG CcPinReadNoWaitMiss;
233 ULONG CcPinReadWaitMiss;
234 ULONG CcCopyReadNoWait;
235 ULONG CcCopyReadWait;
236 ULONG CcCopyReadNoWaitMiss;
237 ULONG CcCopyReadWaitMiss;
238 ULONG CcMdlReadNoWait;
240 ULONG CcMdlReadNoWaitMiss;
241 ULONG CcMdlReadWaitMiss;
242 ULONG CcReadaheadIos;
243 ULONG CcLazyWriteIos;
244 ULONG CcLazyWritePages;
247 ULONG ContextSwitches;
252 } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
256 LARGE_INTEGER liKeBootTime;
257 LARGE_INTEGER liKeSystemTime;
258 LARGE_INTEGER liExpTimeZoneBias;
259 ULONG uCurrentTimeZoneId;
261 } SYSTEM_TIME_INFORMATION;
263 /* SystemCacheInformation (21) */
264 typedef struct _SYSTEM_CACHE_INFORMATION
268 ULONG PageFaultCount;
269 ULONG MinimumWorkingSet;
270 ULONG MaximumWorkingSet;
273 } SYSTEM_CACHE_INFORMATION;
275 /* SystemPageFileInformation (18) */
277 struct _SYSTEM_PAGEFILE_INFORMATION
279 ULONG RelativeOffset;
280 ULONG CurrentSizePages;
281 ULONG TotalUsedPages;
283 UNICODE_STRING PagefileFileName;
285 } SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION;
287 /* SystemHandleInformation (16) */
288 /* (see ontypes.h) */
290 struct _SYSTEM_HANDLE_ENTRY
299 } SYSTEM_HANDLE_ENTRY, *PSYSTEM_HANDLE_ENTRY;
302 struct _SYSTEM_HANDLE_INFORMATION
305 SYSTEM_HANDLE_ENTRY Handle [1];
307 } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
309 /* SystemProcessorPerformanceInformation (8) */
311 struct _SYSTEM_PROCESSORTIME_INFO
313 LARGE_INTEGER IdleTime;
314 LARGE_INTEGER KernelTime;
315 LARGE_INTEGER UserTime;
316 LARGE_INTEGER DpcTime;
317 LARGE_INTEGER InterruptTime;
318 ULONG InterruptCount;
321 } SYSTEM_PROCESSORTIME_INFO, *PSYSTEM_PROCESSORTIME_INFO;
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
332 #define Li2Double(x) ((double)((x).QuadPart))
334 #define GR_GDIOBJECTS 0 /* Count of GDI objects */
335 #define GR_USEROBJECTS 1 /* Count of USER objects */
337 typedef LONG (WINAPI *PROCNTQSI)(UINT,PVOID,ULONG,PULONG);
338 typedef DWORD (WINAPI *PROCGGR)(HANDLE,DWORD);
339 typedef BOOL (WINAPI *PROCGPIC)(HANDLE,PIO_COUNTERS);
341 BOOL PerfDataInitialize(void);
342 void PerfDataUninitialize(void);
343 void PerfDataRefresh(void);
345 ULONG PerfDataGetProcessCount(void);
346 ULONG PerfDataGetProcessorUsage(void);
347 ULONG PerfDataGetProcessorSystemUsage(void);
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);
370 ULONG PerfDataGetCommitChargeTotalK(void);
371 ULONG PerfDataGetCommitChargeLimitK(void);
372 ULONG PerfDataGetCommitChargePeakK(void);
374 ULONG PerfDataGetKernelMemoryTotalK(void);
375 ULONG PerfDataGetKernelMemoryPagedK(void);
376 ULONG PerfDataGetKernelMemoryNonPagedK(void);
378 ULONG PerfDataGetPhysicalMemoryTotalK(void);
379 ULONG PerfDataGetPhysicalMemoryAvailableK(void);
380 ULONG PerfDataGetPhysicalMemorySystemCacheK(void);
382 ULONG PerfDataGetSystemHandleCount(void);
384 ULONG PerfDataGetTotalThreadCount(void);
391 #endif /* __PERFDATA_H */