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 WCHAR UNICODE_STRING; */
41 typedef struct _UNICODE_STRING {
45 } UNICODE_STRING, *PUNICODE_STRING;
47 typedef struct _PERFDATA
49 WCHAR ImageName[MAX_PATH];
51 WCHAR UserName[MAX_PATH];
55 ULONG WorkingSetSizeBytes;
56 ULONG PeakWorkingSetSizeBytes;
57 ULONG WorkingSetSizeDelta;
59 ULONG PageFaultCountDelta;
60 ULONG VirtualMemorySizeBytes;
61 ULONG PagedPoolUsagePages;
62 ULONG NonPagedPoolUsagePages;
66 ULONG USERObjectCount;
68 IO_COUNTERS IOCounters;
72 } PERFDATA, *PPERFDATA;
74 typedef struct _CLIENT_ID
78 } CLIENT_ID, *PCLIENT_ID;
80 typedef enum _KWAIT_REASON
110 /* SystemProcessThreadInfo (5) */
111 typedef struct _SYSTEM_THREAD_INFORMATION
119 ULONG DynamicPriority;
123 KWAIT_REASON WaitReason;
125 } SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION;
127 typedef struct SYSTEM_PROCESS_INFORMATION
129 ULONG RelativeOffset;
138 ULONG ParentProcessId;
142 ULONG PeakVirtualSizeBytes;
143 ULONG TotalVirtualSizeBytes;
144 ULONG PageFaultCount;
145 ULONG PeakWorkingSetSizeBytes;
146 ULONG TotalWorkingSetSizeBytes;
147 ULONG PeakPagedPoolUsagePages;
148 ULONG TotalPagedPoolUsagePages;
149 ULONG PeakNonPagedPoolUsagePages;
150 ULONG TotalNonPagedPoolUsagePages;
151 ULONG TotalPageFileUsageBytes;
152 ULONG PeakPageFileUsageBytes;
153 ULONG TotalPrivateBytes;
154 SYSTEM_THREAD_INFORMATION ThreadSysInfo [1];
156 } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
161 ULONG uKeMaximumIncrement;
163 ULONG uMmNumberOfPhysicalPages;
164 ULONG uMmLowestPhysicalPage;
165 ULONG uMmHighestPhysicalPage;
166 ULONG uAllocationGranularity;
167 PVOID pLowestUserAddress;
168 PVOID pMmHighestUserAddress;
169 ULONG uKeActiveProcessors;
170 BYTE bKeNumberProcessors;
173 } SYSTEM_BASIC_INFORMATION;
175 /* SystemPerformanceInfo (2) */
176 typedef struct _SYSTEM_PERFORMANCE_INFORMATION
178 LARGE_INTEGER /*TotalProcessorTime*/liIdleTime;
179 LARGE_INTEGER IoReadTransferCount;
180 LARGE_INTEGER IoWriteTransferCount;
181 LARGE_INTEGER IoOtherTransferCount;
182 ULONG IoReadOperationCount;
183 ULONG IoWriteOperationCount;
184 ULONG IoOtherOperationCount;
185 ULONG MmAvailablePages;
186 ULONG MmTotalCommittedPages;
187 ULONG MmTotalCommitLimit;
191 ULONG TransitionFaults;
193 ULONG DemandZeroFaults;
202 ULONG PoolPagedBytes;
203 ULONG PoolNonPagedBytes;
208 ULONG MmTotalSystemFreePtes;
209 ULONG MmSystemCodepage;
210 ULONG MmTotalSystemDriverPages;
211 ULONG MmTotalSystemCodePages;
215 ULONG MmSystemCachePage;
216 ULONG MmPagedPoolPage;
217 ULONG MmSystemDriverPage;
218 ULONG CcFastReadNoWait;
219 ULONG CcFastReadWait;
220 ULONG CcFastReadResourceMiss;
221 ULONG CcFastReadNotPossible;
222 ULONG CcFastMdlReadNoWait;
223 ULONG CcFastMdlReadWait;
224 ULONG CcFastMdlReadResourceMiss;
225 ULONG CcFastMdlReadNotPossible;
226 ULONG CcMapDataNoWait;
228 ULONG CcMapDataNoWaitMiss;
229 ULONG CcMapDataWaitMiss;
230 ULONG CcPinMappedDataCount;
231 ULONG CcPinReadNoWait;
233 ULONG CcPinReadNoWaitMiss;
234 ULONG CcPinReadWaitMiss;
235 ULONG CcCopyReadNoWait;
236 ULONG CcCopyReadWait;
237 ULONG CcCopyReadNoWaitMiss;
238 ULONG CcCopyReadWaitMiss;
239 ULONG CcMdlReadNoWait;
241 ULONG CcMdlReadNoWaitMiss;
242 ULONG CcMdlReadWaitMiss;
243 ULONG CcReadaheadIos;
244 ULONG CcLazyWriteIos;
245 ULONG CcLazyWritePages;
248 ULONG ContextSwitches;
253 } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
257 LARGE_INTEGER liKeBootTime;
258 LARGE_INTEGER liKeSystemTime;
259 LARGE_INTEGER liExpTimeZoneBias;
260 ULONG uCurrentTimeZoneId;
262 } SYSTEM_TIME_INFORMATION;
264 /* SystemCacheInformation (21) */
265 typedef struct _SYSTEM_CACHE_INFORMATION
269 ULONG PageFaultCount;
270 ULONG MinimumWorkingSet;
271 ULONG MaximumWorkingSet;
274 } SYSTEM_CACHE_INFORMATION;
276 /* SystemPageFileInformation (18) */
278 struct _SYSTEM_PAGEFILE_INFORMATION
280 ULONG RelativeOffset;
281 ULONG CurrentSizePages;
282 ULONG TotalUsedPages;
284 UNICODE_STRING PagefileFileName;
286 } SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION;
288 /* SystemHandleInformation (16) */
289 /* (see ontypes.h) */
291 struct _SYSTEM_HANDLE_ENTRY
300 } SYSTEM_HANDLE_ENTRY, *PSYSTEM_HANDLE_ENTRY;
303 struct _SYSTEM_HANDLE_INFORMATION
306 SYSTEM_HANDLE_ENTRY Handle [1];
308 } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
310 /* SystemProcessorPerformanceInformation (8) */
312 struct _SYSTEM_PROCESSORTIME_INFO
314 LARGE_INTEGER IdleTime;
315 LARGE_INTEGER KernelTime;
316 LARGE_INTEGER UserTime;
317 LARGE_INTEGER DpcTime;
318 LARGE_INTEGER InterruptTime;
319 ULONG InterruptCount;
322 } SYSTEM_PROCESSORTIME_INFO, *PSYSTEM_PROCESSORTIME_INFO;
324 #define SystemBasicInformation 0
325 #define SystemPerformanceInformation 2
326 #define SystemTimeInformation 3
327 #define SystemProcessInformation 5
328 #define SystemProcessorTimeInformation 8
329 #define SystemHandleInformation 16
330 #define SystemPageFileInformation 18
331 #define SystemCacheInformation 21
333 #define Li2Double(x) ((double)((x).QuadPart))
335 #define GR_GDIOBJECTS 0 /* Count of GDI objects */
336 #define GR_USEROBJECTS 1 /* Count of USER objects */
338 typedef LONG (WINAPI *PROCNTQSI)(UINT,PVOID,ULONG,PULONG);
339 typedef DWORD (WINAPI *PROCGGR)(HANDLE,DWORD);
340 typedef BOOL (WINAPI *PROCGPIC)(HANDLE,PIO_COUNTERS);
342 BOOL PerfDataInitialize(void);
343 void PerfDataUninitialize(void);
344 void PerfDataRefresh(void);
346 ULONG PerfDataGetProcessCount(void);
347 ULONG PerfDataGetProcessorUsage(void);
348 ULONG PerfDataGetProcessorSystemUsage(void);
350 BOOL PerfDataGetImageName(ULONG Index, LPTSTR lpImageName, int nMaxCount);
351 ULONG PerfDataGetProcessId(ULONG Index);
352 BOOL PerfDataGetUserName(ULONG Index, LPTSTR lpUserName, int nMaxCount);
353 ULONG PerfDataGetSessionId(ULONG Index);
354 ULONG PerfDataGetCPUUsage(ULONG Index);
355 TIME PerfDataGetCPUTime(ULONG Index);
356 ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index);
357 ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index);
358 ULONG PerfDataGetWorkingSetSizeDelta(ULONG Index);
359 ULONG PerfDataGetPageFaultCount(ULONG Index);
360 ULONG PerfDataGetPageFaultCountDelta(ULONG Index);
361 ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index);
362 ULONG PerfDataGetPagedPoolUsagePages(ULONG Index);
363 ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index);
364 ULONG PerfDataGetBasePriority(ULONG Index);
365 ULONG PerfDataGetHandleCount(ULONG Index);
366 ULONG PerfDataGetThreadCount(ULONG Index);
367 ULONG PerfDataGetUSERObjectCount(ULONG Index);
368 ULONG PerfDataGetGDIObjectCount(ULONG Index);
369 BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters);
371 ULONG PerfDataGetCommitChargeTotalK(void);
372 ULONG PerfDataGetCommitChargeLimitK(void);
373 ULONG PerfDataGetCommitChargePeakK(void);
375 ULONG PerfDataGetKernelMemoryTotalK(void);
376 ULONG PerfDataGetKernelMemoryPagedK(void);
377 ULONG PerfDataGetKernelMemoryNonPagedK(void);
379 ULONG PerfDataGetPhysicalMemoryTotalK(void);
380 ULONG PerfDataGetPhysicalMemoryAvailableK(void);
381 ULONG PerfDataGetPhysicalMemorySystemCacheK(void);
383 ULONG PerfDataGetSystemHandleCount(void);
385 ULONG PerfDataGetTotalThreadCount(void);
392 #endif /* __PERFDATA_H */