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 Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22 
23 #pragma once
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + (double)((x).LowPart))
30 
31 typedef struct _PERFDATA
32 {
33 	WCHAR				ImageName[MAX_PATH];
34 	HANDLE				ProcessId;
35 	WCHAR				UserName[MAX_PATH];
36 	ULONG				SessionId;
37 	ULONG				CPUUsage;
38 	LARGE_INTEGER		CPUTime;
39 	ULONG				WorkingSetSizeBytes;
40 	ULONG				PeakWorkingSetSizeBytes;
41 	ULONG				WorkingSetSizeDelta;
42 	ULONG				PageFaultCount;
43 	ULONG				PageFaultCountDelta;
44 	ULONG				VirtualMemorySizeBytes;
45 	ULONG				PagedPoolUsagePages;
46 	ULONG				NonPagedPoolUsagePages;
47 	ULONG				BasePriority;
48 	ULONG				HandleCount;
49 	ULONG				ThreadCount;
50 	ULONG				USERObjectCount;
51 	ULONG				GDIObjectCount;
52 	IO_COUNTERS			IOCounters;
53 
54 	LARGE_INTEGER		UserTime;
55 	LARGE_INTEGER		KernelTime;
56 } PERFDATA, *PPERFDATA;
57 
58 typedef struct _CMD_LINE_CACHE
59 {
60      DWORD idx;
61     LPWSTR str;
62      ULONG len;
63     struct _CMD_LINE_CACHE* pnext;
64 } CMD_LINE_CACHE, *PCMD_LINE_CACHE;
65 
66 BOOL	PerfDataInitialize(void);
67 void	PerfDataUninitialize(void);
68 void	PerfDataRefresh(void);
69 
70 BOOL	PerfDataGet(ULONG Index, PPERFDATA *lppData);
71 ULONG	PerfDataGetProcessIndex(ULONG pid);
72 ULONG	PerfDataGetProcessCount(void);
73 ULONG	PerfDataGetProcessorUsage(void);
74 ULONG	PerfDataGetProcessorSystemUsage(void);
75 
76 BOOL	PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, ULONG nMaxCount);
77 ULONG	PerfDataGetProcessId(ULONG Index);
78 BOOL	PerfDataGetUserName(ULONG Index, LPWSTR lpUserName, ULONG nMaxCount);
79 
80 BOOL	PerfDataGetCommandLine(ULONG Index, LPWSTR lpCommandLine, ULONG nMaxCount);
81 void	PerfDataDeallocCommandLineCache();
82 
83 ULONG	PerfDataGetSessionId(ULONG Index);
84 ULONG	PerfDataGetCPUUsage(ULONG Index);
85 LARGE_INTEGER	PerfDataGetCPUTime(ULONG Index);
86 ULONG	PerfDataGetWorkingSetSizeBytes(ULONG Index);
87 ULONG	PerfDataGetPeakWorkingSetSizeBytes(ULONG Index);
88 ULONG	PerfDataGetWorkingSetSizeDelta(ULONG Index);
89 ULONG	PerfDataGetPageFaultCount(ULONG Index);
90 ULONG	PerfDataGetPageFaultCountDelta(ULONG Index);
91 ULONG	PerfDataGetVirtualMemorySizeBytes(ULONG Index);
92 ULONG	PerfDataGetPagedPoolUsagePages(ULONG Index);
93 ULONG	PerfDataGetNonPagedPoolUsagePages(ULONG Index);
94 ULONG	PerfDataGetBasePriority(ULONG Index);
95 ULONG	PerfDataGetHandleCount(ULONG Index);
96 ULONG	PerfDataGetThreadCount(ULONG Index);
97 ULONG	PerfDataGetUSERObjectCount(ULONG Index);
98 ULONG	PerfDataGetGDIObjectCount(ULONG Index);
99 BOOL	PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters);
100 
101 ULONG	PerfDataGetCommitChargeTotalK(void);
102 ULONG	PerfDataGetCommitChargeLimitK(void);
103 ULONG	PerfDataGetCommitChargePeakK(void);
104 
105 ULONG	PerfDataGetKernelMemoryTotalK(void);
106 ULONG	PerfDataGetKernelMemoryPagedK(void);
107 ULONG	PerfDataGetKernelMemoryNonPagedK(void);
108 
109 ULONG	PerfDataGetPhysicalMemoryTotalK(void);
110 ULONG	PerfDataGetPhysicalMemoryAvailableK(void);
111 ULONG	PerfDataGetPhysicalMemorySystemCacheK(void);
112 
113 ULONG	PerfDataGetSystemHandleCount(void);
114 
115 ULONG	PerfDataGetTotalThreadCount(void);
116 
117 
118 #ifdef __cplusplus
119 };
120 #endif
121