1 /* 2 * PROJECT: ReactOS Task Manager 3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) 4 * PURPOSE: Performance Counters 5 * COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@reactos.org> 6 * Copyright 2014 Ismael Ferreras Morezuelas <swyterzone+ros@gmail.com> 7 */ 8 9 #pragma once 10 11 #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + (double)((x).LowPart)) 12 13 typedef struct _PERFDATA 14 { 15 WCHAR ImageName[MAX_PATH]; 16 HANDLE ProcessId; 17 WCHAR UserName[MAX_PATH]; 18 ULONG SessionId; 19 ULONG CPUUsage; 20 LARGE_INTEGER CPUTime; 21 ULONG WorkingSetSizeBytes; 22 ULONG PeakWorkingSetSizeBytes; 23 ULONG WorkingSetSizeDelta; 24 ULONG PageFaultCount; 25 ULONG PageFaultCountDelta; 26 ULONG VirtualMemorySizeBytes; 27 ULONG PagedPoolUsagePages; 28 ULONG NonPagedPoolUsagePages; 29 ULONG BasePriority; 30 ULONG HandleCount; 31 ULONG ThreadCount; 32 ULONG USERObjectCount; 33 ULONG GDIObjectCount; 34 IO_COUNTERS IOCounters; 35 36 LARGE_INTEGER UserTime; 37 LARGE_INTEGER KernelTime; 38 } PERFDATA, *PPERFDATA; 39 40 typedef struct _CMD_LINE_CACHE 41 { 42 DWORD idx; 43 LPWSTR str; 44 ULONG len; 45 struct _CMD_LINE_CACHE* pnext; 46 } CMD_LINE_CACHE, *PCMD_LINE_CACHE; 47 48 BOOL PerfDataInitialize(void); 49 void PerfDataUninitialize(void); 50 void PerfDataRefresh(void); 51 52 BOOL PerfDataGet(ULONG Index, PPERFDATA *lppData); 53 ULONG PerfDataGetProcessIndex(ULONG pid); 54 ULONG PerfDataGetProcessCount(void); 55 ULONG PerfDataGetProcessorUsage(void); 56 ULONG PerfDataGetProcessorSystemUsage(void); 57 58 BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, ULONG nMaxCount); 59 ULONG PerfDataGetProcessId(ULONG Index); 60 BOOL PerfDataGetUserName(ULONG Index, LPWSTR lpUserName, ULONG nMaxCount); 61 62 BOOL PerfDataGetCommandLine(ULONG Index, LPWSTR lpCommandLine, ULONG nMaxCount); 63 void PerfDataDeallocCommandLineCache(); 64 65 ULONG PerfDataGetSessionId(ULONG Index); 66 ULONG PerfDataGetCPUUsage(ULONG Index); 67 LARGE_INTEGER PerfDataGetCPUTime(ULONG Index); 68 ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index); 69 ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index); 70 ULONG PerfDataGetWorkingSetSizeDelta(ULONG Index); 71 ULONG PerfDataGetPageFaultCount(ULONG Index); 72 ULONG PerfDataGetPageFaultCountDelta(ULONG Index); 73 ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index); 74 ULONG PerfDataGetPagedPoolUsagePages(ULONG Index); 75 ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index); 76 ULONG PerfDataGetBasePriority(ULONG Index); 77 ULONG PerfDataGetHandleCount(ULONG Index); 78 ULONG PerfDataGetThreadCount(ULONG Index); 79 ULONG PerfDataGetUSERObjectCount(ULONG Index); 80 ULONG PerfDataGetGDIObjectCount(ULONG Index); 81 BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters); 82 83 ULONG PerfDataGetCommitChargeTotalK(void); 84 ULONG PerfDataGetCommitChargeLimitK(void); 85 ULONG PerfDataGetCommitChargePeakK(void); 86 87 ULONG PerfDataGetKernelMemoryTotalK(void); 88 ULONG PerfDataGetKernelMemoryPagedK(void); 89 ULONG PerfDataGetKernelMemoryNonPagedK(void); 90 91 ULONG PerfDataGetPhysicalMemoryTotalK(void); 92 ULONG PerfDataGetPhysicalMemoryAvailableK(void); 93 ULONG PerfDataGetPhysicalMemorySystemCacheK(void); 94 95 ULONG PerfDataGetSystemHandleCount(void); 96 97 ULONG PerfDataGetTotalThreadCount(void); 98