taskmgr: Use definitions from winternl.h instead of duplicating them.
This commit is contained in:
parent
69abf20fcd
commit
31f8893678
@ -1363,7 +1363,7 @@ typedef struct _SYSTEM_PROCESS_INFORMATION {
|
|||||||
HANDLE UniqueProcessId; /* 44/50 */
|
HANDLE UniqueProcessId; /* 44/50 */
|
||||||
HANDLE ParentProcessId; /* 48/58 */
|
HANDLE ParentProcessId; /* 48/58 */
|
||||||
ULONG HandleCount; /* 4c/60 */
|
ULONG HandleCount; /* 4c/60 */
|
||||||
DWORD dwUnknown3; /* 50/64 */
|
ULONG SessionId; /* 50/64 */
|
||||||
DWORD dwUnknown4; /* 54/68 */
|
DWORD dwUnknown4; /* 54/68 */
|
||||||
VM_COUNTERS vmCounters; /* 58/70 */
|
VM_COUNTERS vmCounters; /* 58/70 */
|
||||||
IO_COUNTERS ioCounters; /* 88/d0 */
|
IO_COUNTERS ioCounters; /* 88/d0 */
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "taskmgr.h"
|
#include "taskmgr.h"
|
||||||
#include "perfdata.h"
|
#include "perfdata.h"
|
||||||
|
|
||||||
static PROCNTQSI NtQuerySystemInformation = NULL;
|
static PROCNTQSI pNtQuerySystemInformation = NULL;
|
||||||
static PROCGGR pGetGuiResources = NULL;
|
static PROCGGR pGetGuiResources = NULL;
|
||||||
static PROCGPIC pGetProcessIoCounters = NULL;
|
static PROCGPIC pGetProcessIoCounters = NULL;
|
||||||
static CRITICAL_SECTION PerfDataCriticalSection;
|
static CRITICAL_SECTION PerfDataCriticalSection;
|
||||||
@ -48,7 +48,7 @@ static SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo;
|
|||||||
static SYSTEM_BASIC_INFORMATION SystemBasicInfo;
|
static SYSTEM_BASIC_INFORMATION SystemBasicInfo;
|
||||||
static SYSTEM_CACHE_INFORMATION SystemCacheInfo;
|
static SYSTEM_CACHE_INFORMATION SystemCacheInfo;
|
||||||
static SYSTEM_HANDLE_INFORMATION SystemHandleInfo;
|
static SYSTEM_HANDLE_INFORMATION SystemHandleInfo;
|
||||||
static PSYSTEM_PROCESSORTIME_INFO SystemProcessorTimeInfo = NULL;
|
static PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemProcessorTimeInfo = NULL;
|
||||||
|
|
||||||
BOOL PerfDataInitialize(void)
|
BOOL PerfDataInitialize(void)
|
||||||
{
|
{
|
||||||
@ -57,32 +57,25 @@ BOOL PerfDataInitialize(void)
|
|||||||
static const WCHAR wszUser32[] = {'u','s','e','r','3','2','.','d','l','l',0};
|
static const WCHAR wszUser32[] = {'u','s','e','r','3','2','.','d','l','l',0};
|
||||||
static const WCHAR wszKernel32[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
|
static const WCHAR wszKernel32[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
|
||||||
|
|
||||||
NtQuerySystemInformation = (PROCNTQSI)GetProcAddress(GetModuleHandleW(wszNtdll), "NtQuerySystemInformation");
|
pNtQuerySystemInformation = (PROCNTQSI)GetProcAddress(GetModuleHandleW(wszNtdll), "NtQuerySystemInformation");
|
||||||
pGetGuiResources = (PROCGGR)GetProcAddress(GetModuleHandleW(wszUser32), "GetGuiResources");
|
pGetGuiResources = (PROCGGR)GetProcAddress(GetModuleHandleW(wszUser32), "GetGuiResources");
|
||||||
pGetProcessIoCounters = (PROCGPIC)GetProcAddress(GetModuleHandleW(wszKernel32), "GetProcessIoCounters");
|
pGetProcessIoCounters = (PROCGPIC)GetProcAddress(GetModuleHandleW(wszKernel32), "GetProcessIoCounters");
|
||||||
|
|
||||||
InitializeCriticalSection(&PerfDataCriticalSection);
|
InitializeCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
if (!NtQuerySystemInformation)
|
if (!pNtQuerySystemInformation)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get number of processors in the system
|
* Get number of processors in the system
|
||||||
*/
|
*/
|
||||||
status = NtQuerySystemInformation(SystemBasicInformation, &SystemBasicInfo, sizeof(SystemBasicInfo), NULL);
|
status = pNtQuerySystemInformation(SystemBasicInformation, &SystemBasicInfo, sizeof(SystemBasicInfo), NULL);
|
||||||
if (status != NO_ERROR)
|
if (status != NO_ERROR)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerfDataUninitialize(void)
|
|
||||||
{
|
|
||||||
NtQuerySystemInformation = NULL;
|
|
||||||
|
|
||||||
DeleteCriticalSection(&PerfDataCriticalSection);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PerfDataRefresh(void)
|
void PerfDataRefresh(void)
|
||||||
{
|
{
|
||||||
ULONG ulSize;
|
ULONG ulSize;
|
||||||
@ -97,35 +90,32 @@ void PerfDataRefresh(void)
|
|||||||
WCHAR wszTemp[MAX_PATH];
|
WCHAR wszTemp[MAX_PATH];
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
SYSTEM_PERFORMANCE_INFORMATION SysPerfInfo;
|
SYSTEM_PERFORMANCE_INFORMATION SysPerfInfo;
|
||||||
SYSTEM_TIME_INFORMATION SysTimeInfo;
|
SYSTEM_TIMEOFDAY_INFORMATION SysTimeInfo;
|
||||||
SYSTEM_CACHE_INFORMATION SysCacheInfo;
|
SYSTEM_CACHE_INFORMATION SysCacheInfo;
|
||||||
LPBYTE SysHandleInfoData;
|
LPBYTE SysHandleInfoData;
|
||||||
PSYSTEM_PROCESSORTIME_INFO SysProcessorTimeInfo;
|
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION *SysProcessorTimeInfo;
|
||||||
double CurrentKernelTime;
|
double CurrentKernelTime;
|
||||||
|
|
||||||
|
|
||||||
if (!NtQuerySystemInformation)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Get new system time */
|
/* Get new system time */
|
||||||
status = NtQuerySystemInformation(SystemTimeInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0);
|
status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0);
|
||||||
if (status != NO_ERROR)
|
if (status != NO_ERROR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Get new CPU's idle time */
|
/* Get new CPU's idle time */
|
||||||
status = NtQuerySystemInformation(SystemPerformanceInformation, &SysPerfInfo, sizeof(SysPerfInfo), NULL);
|
status = pNtQuerySystemInformation(SystemPerformanceInformation, &SysPerfInfo, sizeof(SysPerfInfo), NULL);
|
||||||
if (status != NO_ERROR)
|
if (status != NO_ERROR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Get system cache information */
|
/* Get system cache information */
|
||||||
status = NtQuerySystemInformation(SystemCacheInformation, &SysCacheInfo, sizeof(SysCacheInfo), NULL);
|
status = pNtQuerySystemInformation(SystemCacheInformation, &SysCacheInfo, sizeof(SysCacheInfo), NULL);
|
||||||
if (status != NO_ERROR)
|
if (status != NO_ERROR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Get processor time information */
|
/* Get processor time information */
|
||||||
SysProcessorTimeInfo = HeapAlloc(GetProcessHeap(), 0,
|
SysProcessorTimeInfo = HeapAlloc(GetProcessHeap(), 0,
|
||||||
sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors);
|
sizeof(*SysProcessorTimeInfo) * SystemBasicInfo.NumberOfProcessors);
|
||||||
status = NtQuerySystemInformation(SystemProcessorTimeInformation, SysProcessorTimeInfo, sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors, &ulSize);
|
status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, SysProcessorTimeInfo, sizeof(*SysProcessorTimeInfo) * SystemBasicInfo.NumberOfProcessors, &ulSize);
|
||||||
if (status != NO_ERROR) {
|
if (status != NO_ERROR) {
|
||||||
HeapFree(GetProcessHeap(), 0, SysProcessorTimeInfo);
|
HeapFree(GetProcessHeap(), 0, SysProcessorTimeInfo);
|
||||||
return;
|
return;
|
||||||
@ -141,7 +131,7 @@ void PerfDataRefresh(void)
|
|||||||
BufferSize += 0x10000;
|
BufferSize += 0x10000;
|
||||||
SysHandleInfoData = HeapAlloc(GetProcessHeap(), 0, BufferSize);
|
SysHandleInfoData = HeapAlloc(GetProcessHeap(), 0, BufferSize);
|
||||||
|
|
||||||
status = NtQuerySystemInformation(SystemHandleInformation, SysHandleInfoData, BufferSize, &ulSize);
|
status = pNtQuerySystemInformation(SystemHandleInformation, SysHandleInfoData, BufferSize, &ulSize);
|
||||||
|
|
||||||
if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) {
|
if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) {
|
||||||
HeapFree(GetProcessHeap(), 0, SysHandleInfoData);
|
HeapFree(GetProcessHeap(), 0, SysHandleInfoData);
|
||||||
@ -159,7 +149,7 @@ void PerfDataRefresh(void)
|
|||||||
BufferSize += 0x10000;
|
BufferSize += 0x10000;
|
||||||
pBuffer = HeapAlloc(GetProcessHeap(), 0, BufferSize);
|
pBuffer = HeapAlloc(GetProcessHeap(), 0, BufferSize);
|
||||||
|
|
||||||
status = NtQuerySystemInformation(SystemProcessInformation, pBuffer, BufferSize, &ulSize);
|
status = pNtQuerySystemInformation(SystemProcessInformation, pBuffer, BufferSize, &ulSize);
|
||||||
|
|
||||||
if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) {
|
if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) {
|
||||||
HeapFree(GetProcessHeap(), 0, pBuffer);
|
HeapFree(GetProcessHeap(), 0, pBuffer);
|
||||||
@ -191,16 +181,16 @@ void PerfDataRefresh(void)
|
|||||||
memcpy(&SystemHandleInfo, SysHandleInfoData, sizeof(SYSTEM_HANDLE_INFORMATION));
|
memcpy(&SystemHandleInfo, SysHandleInfoData, sizeof(SYSTEM_HANDLE_INFORMATION));
|
||||||
HeapFree(GetProcessHeap(), 0, SysHandleInfoData);
|
HeapFree(GetProcessHeap(), 0, SysHandleInfoData);
|
||||||
|
|
||||||
for (CurrentKernelTime=0, Idx=0; Idx<SystemBasicInfo.bKeNumberProcessors; Idx++) {
|
for (CurrentKernelTime=0, Idx=0; Idx<SystemBasicInfo.NumberOfProcessors; Idx++) {
|
||||||
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].KernelTime);
|
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].KernelTime);
|
||||||
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].DpcTime);
|
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].Reserved1[0]);
|
||||||
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].InterruptTime);
|
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].Reserved1[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's a first call - skip idle time calcs */
|
/* If it's a first call - skip idle time calcs */
|
||||||
if (liOldIdleTime.QuadPart != 0) {
|
if (liOldIdleTime.QuadPart != 0) {
|
||||||
/* CurrentValue = NewValue - OldValue */
|
/* CurrentValue = NewValue - OldValue */
|
||||||
dbIdleTime = Li2Double(SysPerfInfo.liIdleTime) - Li2Double(liOldIdleTime);
|
dbIdleTime = Li2Double(SysPerfInfo.IdleTime) - Li2Double(liOldIdleTime);
|
||||||
dbKernelTime = CurrentKernelTime - OldKernelTime;
|
dbKernelTime = CurrentKernelTime - OldKernelTime;
|
||||||
dbSystemTime = Li2Double(SysTimeInfo.liKeSystemTime) - Li2Double(liOldSystemTime);
|
dbSystemTime = Li2Double(SysTimeInfo.liKeSystemTime) - Li2Double(liOldSystemTime);
|
||||||
|
|
||||||
@ -209,12 +199,12 @@ void PerfDataRefresh(void)
|
|||||||
dbKernelTime = dbKernelTime / dbSystemTime;
|
dbKernelTime = dbKernelTime / dbSystemTime;
|
||||||
|
|
||||||
/* CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors */
|
/* CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors */
|
||||||
dbIdleTime = 100.0 - dbIdleTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors; /* + 0.5; */
|
dbIdleTime = 100.0 - dbIdleTime * 100.0 / (double)SystemBasicInfo.NumberOfProcessors; /* + 0.5; */
|
||||||
dbKernelTime = 100.0 - dbKernelTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors; /* + 0.5; */
|
dbKernelTime = 100.0 - dbKernelTime * 100.0 / (double)SystemBasicInfo.NumberOfProcessors; /* + 0.5; */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store new CPU's idle and system time */
|
/* Store new CPU's idle and system time */
|
||||||
liOldIdleTime = SysPerfInfo.liIdleTime;
|
liOldIdleTime = SysPerfInfo.IdleTime;
|
||||||
liOldSystemTime = SysTimeInfo.liKeSystemTime;
|
liOldSystemTime = SysTimeInfo.liKeSystemTime;
|
||||||
OldKernelTime = CurrentKernelTime;
|
OldKernelTime = CurrentKernelTime;
|
||||||
|
|
||||||
@ -227,9 +217,9 @@ void PerfDataRefresh(void)
|
|||||||
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
|
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
|
||||||
while (pSPI) {
|
while (pSPI) {
|
||||||
ProcessCount++;
|
ProcessCount++;
|
||||||
if (pSPI->RelativeOffset == 0)
|
if (pSPI->NextEntryOffset == 0)
|
||||||
break;
|
break;
|
||||||
pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->RelativeOffset);
|
pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->NextEntryOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now alloc a new PERFDATA array and fill in the data */
|
/* Now alloc a new PERFDATA array and fill in the data */
|
||||||
@ -242,7 +232,7 @@ void PerfDataRefresh(void)
|
|||||||
/* so that we can establish delta values */
|
/* so that we can establish delta values */
|
||||||
pPDOld = NULL;
|
pPDOld = NULL;
|
||||||
for (Idx2=0; Idx2<ProcessCountOld; Idx2++) {
|
for (Idx2=0; Idx2<ProcessCountOld; Idx2++) {
|
||||||
if (pPerfDataOld[Idx2].ProcessId == pSPI->ProcessId) {
|
if (pPerfDataOld[Idx2].ProcessId == (DWORD_PTR)pSPI->UniqueProcessId) {
|
||||||
pPDOld = &pPerfDataOld[Idx2];
|
pPDOld = &pPerfDataOld[Idx2];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -251,8 +241,8 @@ void PerfDataRefresh(void)
|
|||||||
/* Clear out process perf data structure */
|
/* Clear out process perf data structure */
|
||||||
memset(&pPerfData[Idx], 0, sizeof(PERFDATA));
|
memset(&pPerfData[Idx], 0, sizeof(PERFDATA));
|
||||||
|
|
||||||
if (pSPI->Name.Buffer)
|
if (pSPI->ProcessName.Buffer)
|
||||||
lstrcpyW(pPerfData[Idx].ImageName, pSPI->Name.Buffer);
|
lstrcpyW(pPerfData[Idx].ImageName, pSPI->ProcessName.Buffer);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WCHAR idleW[255];
|
WCHAR idleW[255];
|
||||||
@ -260,36 +250,37 @@ void PerfDataRefresh(void)
|
|||||||
lstrcpyW(pPerfData[Idx].ImageName, idleW );
|
lstrcpyW(pPerfData[Idx].ImageName, idleW );
|
||||||
}
|
}
|
||||||
|
|
||||||
pPerfData[Idx].ProcessId = pSPI->ProcessId;
|
pPerfData[Idx].ProcessId = (DWORD_PTR)pSPI->UniqueProcessId;
|
||||||
|
|
||||||
if (pPDOld) {
|
if (pPDOld) {
|
||||||
double CurTime = Li2Double(pSPI->KernelTime) + Li2Double(pSPI->UserTime);
|
double CurTime = Li2Double(pSPI->KernelTime) + Li2Double(pSPI->UserTime);
|
||||||
double OldTime = Li2Double(pPDOld->KernelTime) + Li2Double(pPDOld->UserTime);
|
double OldTime = Li2Double(pPDOld->KernelTime) + Li2Double(pPDOld->UserTime);
|
||||||
double CpuTime = (CurTime - OldTime) / dbSystemTime;
|
double CpuTime = (CurTime - OldTime) / dbSystemTime;
|
||||||
CpuTime = CpuTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors; /* + 0.5; */
|
CpuTime = CpuTime * 100.0 / (double)SystemBasicInfo.NumberOfProcessors; /* + 0.5; */
|
||||||
pPerfData[Idx].CPUUsage = (ULONG)CpuTime;
|
pPerfData[Idx].CPUUsage = (ULONG)CpuTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
pPerfData[Idx].CPUTime.QuadPart = pSPI->UserTime.QuadPart + pSPI->KernelTime.QuadPart;
|
pPerfData[Idx].CPUTime.QuadPart = pSPI->UserTime.QuadPart + pSPI->KernelTime.QuadPart;
|
||||||
pPerfData[Idx].WorkingSetSizeBytes = pSPI->TotalWorkingSetSizeBytes;
|
pPerfData[Idx].vmCounters.WorkingSetSize = pSPI->vmCounters.WorkingSetSize;
|
||||||
pPerfData[Idx].PeakWorkingSetSizeBytes = pSPI->PeakWorkingSetSizeBytes;
|
pPerfData[Idx].vmCounters.PeakWorkingSetSize = pSPI->vmCounters.PeakWorkingSetSize;
|
||||||
if (pPDOld)
|
if (pPDOld)
|
||||||
pPerfData[Idx].WorkingSetSizeDelta = labs((LONG)pSPI->TotalWorkingSetSizeBytes - (LONG)pPDOld->WorkingSetSizeBytes);
|
pPerfData[Idx].WorkingSetSizeDelta = labs(pSPI->vmCounters.WorkingSetSize - pPDOld->vmCounters.WorkingSetSize);
|
||||||
else
|
else
|
||||||
pPerfData[Idx].WorkingSetSizeDelta = 0;
|
pPerfData[Idx].WorkingSetSizeDelta = 0;
|
||||||
pPerfData[Idx].PageFaultCount = pSPI->PageFaultCount;
|
pPerfData[Idx].vmCounters.PageFaultCount = pSPI->vmCounters.PageFaultCount;
|
||||||
if (pPDOld)
|
if (pPDOld)
|
||||||
pPerfData[Idx].PageFaultCountDelta = labs((LONG)pSPI->PageFaultCount - (LONG)pPDOld->PageFaultCount);
|
pPerfData[Idx].PageFaultCountDelta = labs(pSPI->vmCounters.PageFaultCount - pPDOld->vmCounters.PageFaultCount);
|
||||||
else
|
else
|
||||||
pPerfData[Idx].PageFaultCountDelta = 0;
|
pPerfData[Idx].PageFaultCountDelta = 0;
|
||||||
pPerfData[Idx].VirtualMemorySizeBytes = pSPI->TotalVirtualSizeBytes;
|
pPerfData[Idx].vmCounters.VirtualSize = pSPI->vmCounters.VirtualSize;
|
||||||
pPerfData[Idx].PagedPoolUsagePages = pSPI->TotalPagedPoolUsagePages;
|
pPerfData[Idx].vmCounters.QuotaPagedPoolUsage = pSPI->vmCounters.QuotaPagedPoolUsage;
|
||||||
pPerfData[Idx].NonPagedPoolUsagePages = pSPI->TotalNonPagedPoolUsagePages;
|
pPerfData[Idx].vmCounters.QuotaNonPagedPoolUsage = pSPI->vmCounters.QuotaNonPagedPoolUsage;
|
||||||
pPerfData[Idx].BasePriority = pSPI->BasePriority;
|
pPerfData[Idx].BasePriority = pSPI->dwBasePriority;
|
||||||
pPerfData[Idx].HandleCount = pSPI->HandleCount;
|
pPerfData[Idx].HandleCount = pSPI->HandleCount;
|
||||||
pPerfData[Idx].ThreadCount = pSPI->ThreadCount;
|
pPerfData[Idx].ThreadCount = pSPI->dwThreadCount;
|
||||||
pPerfData[Idx].SessionId = pSPI->SessionId;
|
pPerfData[Idx].SessionId = pSPI->SessionId;
|
||||||
|
|
||||||
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pSPI->ProcessId);
|
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, (DWORD_PTR)pSPI->UniqueProcessId);
|
||||||
if (hProcess) {
|
if (hProcess) {
|
||||||
if (OpenProcessToken(hProcess, TOKEN_QUERY|TOKEN_DUPLICATE|TOKEN_IMPERSONATE, &hProcessToken)) {
|
if (OpenProcessToken(hProcess, TOKEN_QUERY|TOKEN_DUPLICATE|TOKEN_IMPERSONATE, &hProcessToken)) {
|
||||||
ImpersonateLoggedOnUser(hProcessToken);
|
ImpersonateLoggedOnUser(hProcessToken);
|
||||||
@ -309,7 +300,7 @@ void PerfDataRefresh(void)
|
|||||||
}
|
}
|
||||||
pPerfData[Idx].UserTime.QuadPart = pSPI->UserTime.QuadPart;
|
pPerfData[Idx].UserTime.QuadPart = pSPI->UserTime.QuadPart;
|
||||||
pPerfData[Idx].KernelTime.QuadPart = pSPI->KernelTime.QuadPart;
|
pPerfData[Idx].KernelTime.QuadPart = pSPI->KernelTime.QuadPart;
|
||||||
pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->RelativeOffset);
|
pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->NextEntryOffset);
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, pBuffer);
|
HeapFree(GetProcessHeap(), 0, pBuffer);
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
@ -441,7 +432,7 @@ ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index)
|
|||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
if (Index < ProcessCount)
|
if (Index < ProcessCount)
|
||||||
WorkingSetSizeBytes = pPerfData[Index].WorkingSetSizeBytes;
|
WorkingSetSizeBytes = pPerfData[Index].vmCounters.WorkingSetSize;
|
||||||
else
|
else
|
||||||
WorkingSetSizeBytes = 0;
|
WorkingSetSizeBytes = 0;
|
||||||
|
|
||||||
@ -457,7 +448,7 @@ ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index)
|
|||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
if (Index < ProcessCount)
|
if (Index < ProcessCount)
|
||||||
PeakWorkingSetSizeBytes = pPerfData[Index].PeakWorkingSetSizeBytes;
|
PeakWorkingSetSizeBytes = pPerfData[Index].vmCounters.PeakWorkingSetSize;
|
||||||
else
|
else
|
||||||
PeakWorkingSetSizeBytes = 0;
|
PeakWorkingSetSizeBytes = 0;
|
||||||
|
|
||||||
@ -489,7 +480,7 @@ ULONG PerfDataGetPageFaultCount(ULONG Index)
|
|||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
if (Index < ProcessCount)
|
if (Index < ProcessCount)
|
||||||
PageFaultCount = pPerfData[Index].PageFaultCount;
|
PageFaultCount = pPerfData[Index].vmCounters.PageFaultCount;
|
||||||
else
|
else
|
||||||
PageFaultCount = 0;
|
PageFaultCount = 0;
|
||||||
|
|
||||||
@ -521,7 +512,7 @@ ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index)
|
|||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
if (Index < ProcessCount)
|
if (Index < ProcessCount)
|
||||||
VirtualMemorySizeBytes = pPerfData[Index].VirtualMemorySizeBytes;
|
VirtualMemorySizeBytes = pPerfData[Index].vmCounters.VirtualSize;
|
||||||
else
|
else
|
||||||
VirtualMemorySizeBytes = 0;
|
VirtualMemorySizeBytes = 0;
|
||||||
|
|
||||||
@ -537,7 +528,7 @@ ULONG PerfDataGetPagedPoolUsagePages(ULONG Index)
|
|||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
if (Index < ProcessCount)
|
if (Index < ProcessCount)
|
||||||
PagedPoolUsagePages = pPerfData[Index].PagedPoolUsagePages;
|
PagedPoolUsagePages = pPerfData[Index].vmCounters.QuotaPagedPoolUsage;
|
||||||
else
|
else
|
||||||
PagedPoolUsagePages = 0;
|
PagedPoolUsagePages = 0;
|
||||||
|
|
||||||
@ -553,7 +544,7 @@ ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index)
|
|||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
if (Index < ProcessCount)
|
if (Index < ProcessCount)
|
||||||
NonPagedPoolUsagePages = pPerfData[Index].NonPagedPoolUsagePages;
|
NonPagedPoolUsagePages = pPerfData[Index].vmCounters.QuotaNonPagedPoolUsage;
|
||||||
else
|
else
|
||||||
NonPagedPoolUsagePages = 0;
|
NonPagedPoolUsagePages = 0;
|
||||||
|
|
||||||
@ -668,8 +659,8 @@ ULONG PerfDataGetCommitChargeTotalK(void)
|
|||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Total = SystemPerfInfo.MmTotalCommittedPages;
|
Total = SystemPerfInfo.TotalCommittedPages;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
@ -685,8 +676,8 @@ ULONG PerfDataGetCommitChargeLimitK(void)
|
|||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Limit = SystemPerfInfo.MmTotalCommitLimit;
|
Limit = SystemPerfInfo.TotalCommitLimit;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
@ -702,8 +693,8 @@ ULONG PerfDataGetCommitChargePeakK(void)
|
|||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Peak = SystemPerfInfo.MmPeakLimit;
|
Peak = SystemPerfInfo.PeakCommitment;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
@ -721,9 +712,9 @@ ULONG PerfDataGetKernelMemoryTotalK(void)
|
|||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Paged = SystemPerfInfo.PoolPagedBytes;
|
Paged = SystemPerfInfo.PagedPoolUsage;
|
||||||
NonPaged = SystemPerfInfo.PoolNonPagedBytes;
|
NonPaged = SystemPerfInfo.NonPagedPoolUsage;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
@ -742,8 +733,8 @@ ULONG PerfDataGetKernelMemoryPagedK(void)
|
|||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Paged = SystemPerfInfo.PoolPagedBytes;
|
Paged = SystemPerfInfo.PagedPoolUsage;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
@ -759,8 +750,8 @@ ULONG PerfDataGetKernelMemoryNonPagedK(void)
|
|||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
NonPaged = SystemPerfInfo.PoolNonPagedBytes;
|
NonPaged = SystemPerfInfo.NonPagedPoolUsage;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
@ -776,8 +767,8 @@ ULONG PerfDataGetPhysicalMemoryTotalK(void)
|
|||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Total = SystemBasicInfo.uMmNumberOfPhysicalPages;
|
Total = SystemBasicInfo.MmNumberOfPhysicalPages;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
@ -793,8 +784,8 @@ ULONG PerfDataGetPhysicalMemoryAvailableK(void)
|
|||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Available = SystemPerfInfo.MmAvailablePages;
|
Available = SystemPerfInfo.AvailablePages;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
|
@ -23,25 +23,9 @@
|
|||||||
#ifndef __PERFDATA_H
|
#ifndef __PERFDATA_H
|
||||||
#define __PERFDATA_H
|
#define __PERFDATA_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#include "winternl.h"
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
typedef ULARGE_INTEGER TIME;
|
||||||
#if 0
|
|
||||||
typedef struct _TIME {
|
|
||||||
DWORD LowPart;
|
|
||||||
LONG HighPart;
|
|
||||||
} TIME, *PTIME;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef ULARGE_INTEGER TIME, *PTIME;
|
|
||||||
|
|
||||||
typedef struct _UNICODE_STRING {
|
|
||||||
USHORT Length;
|
|
||||||
USHORT MaximumLength;
|
|
||||||
PWSTR Buffer;
|
|
||||||
} UNICODE_STRING, *PUNICODE_STRING;
|
|
||||||
|
|
||||||
typedef struct _PERFDATA
|
typedef struct _PERFDATA
|
||||||
{
|
{
|
||||||
@ -51,227 +35,20 @@ typedef struct _PERFDATA
|
|||||||
ULONG SessionId;
|
ULONG SessionId;
|
||||||
ULONG CPUUsage;
|
ULONG CPUUsage;
|
||||||
TIME CPUTime;
|
TIME CPUTime;
|
||||||
ULONG WorkingSetSizeBytes;
|
|
||||||
ULONG PeakWorkingSetSizeBytes;
|
|
||||||
ULONG WorkingSetSizeDelta;
|
|
||||||
ULONG PageFaultCount;
|
|
||||||
ULONG PageFaultCountDelta;
|
|
||||||
ULONG VirtualMemorySizeBytes;
|
|
||||||
ULONG PagedPoolUsagePages;
|
|
||||||
ULONG NonPagedPoolUsagePages;
|
|
||||||
ULONG BasePriority;
|
ULONG BasePriority;
|
||||||
ULONG HandleCount;
|
ULONG HandleCount;
|
||||||
ULONG ThreadCount;
|
ULONG ThreadCount;
|
||||||
ULONG USERObjectCount;
|
ULONG USERObjectCount;
|
||||||
ULONG GDIObjectCount;
|
ULONG GDIObjectCount;
|
||||||
|
SIZE_T WorkingSetSizeDelta;
|
||||||
|
ULONG PageFaultCountDelta;
|
||||||
|
VM_COUNTERS vmCounters;
|
||||||
IO_COUNTERS IOCounters;
|
IO_COUNTERS IOCounters;
|
||||||
|
|
||||||
TIME UserTime;
|
TIME UserTime;
|
||||||
TIME KernelTime;
|
TIME KernelTime;
|
||||||
} PERFDATA, *PPERFDATA;
|
} PERFDATA, *PPERFDATA;
|
||||||
|
|
||||||
typedef struct _CLIENT_ID
|
|
||||||
{
|
|
||||||
HANDLE UniqueProcess;
|
|
||||||
HANDLE UniqueThread;
|
|
||||||
} CLIENT_ID, *PCLIENT_ID;
|
|
||||||
|
|
||||||
typedef enum _KWAIT_REASON
|
|
||||||
{
|
|
||||||
Executive,
|
|
||||||
FreePage,
|
|
||||||
PageIn,
|
|
||||||
PoolAllocation,
|
|
||||||
DelayExecution,
|
|
||||||
Suspended,
|
|
||||||
UserRequest,
|
|
||||||
WrExecutive,
|
|
||||||
WrFreePage,
|
|
||||||
WrPageIn,
|
|
||||||
WrDelayExecution,
|
|
||||||
WrSuspended,
|
|
||||||
WrUserRequest,
|
|
||||||
WrQueue,
|
|
||||||
WrLpcReceive,
|
|
||||||
WrLpcReply,
|
|
||||||
WrVirtualMemory,
|
|
||||||
WrPageOut,
|
|
||||||
WrRendezvous,
|
|
||||||
Spare2,
|
|
||||||
Spare3,
|
|
||||||
Spare4,
|
|
||||||
Spare5,
|
|
||||||
Spare6,
|
|
||||||
WrKernel,
|
|
||||||
MaximumWaitReason,
|
|
||||||
} KWAIT_REASON;
|
|
||||||
|
|
||||||
/* SystemProcessThreadInfo (5) */
|
|
||||||
typedef struct _SYSTEM_THREAD_INFORMATION
|
|
||||||
{
|
|
||||||
TIME KernelTime;
|
|
||||||
TIME UserTime;
|
|
||||||
TIME CreateTime;
|
|
||||||
ULONG TickCount;
|
|
||||||
ULONG StartEIP;
|
|
||||||
CLIENT_ID ClientId;
|
|
||||||
ULONG DynamicPriority;
|
|
||||||
ULONG BasePriority;
|
|
||||||
ULONG nSwitches;
|
|
||||||
DWORD State;
|
|
||||||
KWAIT_REASON WaitReason;
|
|
||||||
|
|
||||||
} SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION;
|
|
||||||
|
|
||||||
typedef struct SYSTEM_PROCESS_INFORMATION
|
|
||||||
{
|
|
||||||
ULONG RelativeOffset;
|
|
||||||
ULONG ThreadCount;
|
|
||||||
ULONG Unused1 [6];
|
|
||||||
TIME CreateTime;
|
|
||||||
TIME UserTime;
|
|
||||||
TIME KernelTime;
|
|
||||||
UNICODE_STRING Name;
|
|
||||||
ULONG BasePriority;
|
|
||||||
ULONG ProcessId;
|
|
||||||
ULONG ParentProcessId;
|
|
||||||
ULONG HandleCount;
|
|
||||||
ULONG SessionId;
|
|
||||||
ULONG Unused2;
|
|
||||||
ULONG PeakVirtualSizeBytes;
|
|
||||||
ULONG TotalVirtualSizeBytes;
|
|
||||||
ULONG PageFaultCount;
|
|
||||||
ULONG PeakWorkingSetSizeBytes;
|
|
||||||
ULONG TotalWorkingSetSizeBytes;
|
|
||||||
ULONG PeakPagedPoolUsagePages;
|
|
||||||
ULONG TotalPagedPoolUsagePages;
|
|
||||||
ULONG PeakNonPagedPoolUsagePages;
|
|
||||||
ULONG TotalNonPagedPoolUsagePages;
|
|
||||||
ULONG TotalPageFileUsageBytes;
|
|
||||||
ULONG PeakPageFileUsageBytes;
|
|
||||||
ULONG TotalPrivateBytes;
|
|
||||||
SYSTEM_THREAD_INFORMATION ThreadSysInfo [1];
|
|
||||||
|
|
||||||
} SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
DWORD dwUnknown1;
|
|
||||||
ULONG uKeMaximumIncrement;
|
|
||||||
ULONG uPageSize;
|
|
||||||
ULONG uMmNumberOfPhysicalPages;
|
|
||||||
ULONG uMmLowestPhysicalPage;
|
|
||||||
ULONG uMmHighestPhysicalPage;
|
|
||||||
ULONG uAllocationGranularity;
|
|
||||||
PVOID pLowestUserAddress;
|
|
||||||
PVOID pMmHighestUserAddress;
|
|
||||||
ULONG uKeActiveProcessors;
|
|
||||||
BYTE bKeNumberProcessors;
|
|
||||||
BYTE bUnknown2;
|
|
||||||
WORD wUnknown3;
|
|
||||||
} SYSTEM_BASIC_INFORMATION;
|
|
||||||
|
|
||||||
/* SystemPerformanceInfo (2) */
|
|
||||||
typedef struct _SYSTEM_PERFORMANCE_INFORMATION
|
|
||||||
{
|
|
||||||
LARGE_INTEGER /*TotalProcessorTime*/liIdleTime;
|
|
||||||
LARGE_INTEGER IoReadTransferCount;
|
|
||||||
LARGE_INTEGER IoWriteTransferCount;
|
|
||||||
LARGE_INTEGER IoOtherTransferCount;
|
|
||||||
ULONG IoReadOperationCount;
|
|
||||||
ULONG IoWriteOperationCount;
|
|
||||||
ULONG IoOtherOperationCount;
|
|
||||||
ULONG MmAvailablePages;
|
|
||||||
ULONG MmTotalCommittedPages;
|
|
||||||
ULONG MmTotalCommitLimit;
|
|
||||||
ULONG MmPeakLimit;
|
|
||||||
ULONG PageFaults;
|
|
||||||
ULONG WriteCopies;
|
|
||||||
ULONG TransitionFaults;
|
|
||||||
ULONG Unknown1;
|
|
||||||
ULONG DemandZeroFaults;
|
|
||||||
ULONG PagesInput;
|
|
||||||
ULONG PagesRead;
|
|
||||||
ULONG Unknown2;
|
|
||||||
ULONG Unknown3;
|
|
||||||
ULONG PagesOutput;
|
|
||||||
ULONG PageWrites;
|
|
||||||
ULONG Unknown4;
|
|
||||||
ULONG Unknown5;
|
|
||||||
ULONG PoolPagedBytes;
|
|
||||||
ULONG PoolNonPagedBytes;
|
|
||||||
ULONG Unknown6;
|
|
||||||
ULONG Unknown7;
|
|
||||||
ULONG Unknown8;
|
|
||||||
ULONG Unknown9;
|
|
||||||
ULONG MmTotalSystemFreePtes;
|
|
||||||
ULONG MmSystemCodepage;
|
|
||||||
ULONG MmTotalSystemDriverPages;
|
|
||||||
ULONG MmTotalSystemCodePages;
|
|
||||||
ULONG Unknown10;
|
|
||||||
ULONG Unknown11;
|
|
||||||
ULONG Unknown12;
|
|
||||||
ULONG MmSystemCachePage;
|
|
||||||
ULONG MmPagedPoolPage;
|
|
||||||
ULONG MmSystemDriverPage;
|
|
||||||
ULONG CcFastReadNoWait;
|
|
||||||
ULONG CcFastReadWait;
|
|
||||||
ULONG CcFastReadResourceMiss;
|
|
||||||
ULONG CcFastReadNotPossible;
|
|
||||||
ULONG CcFastMdlReadNoWait;
|
|
||||||
ULONG CcFastMdlReadWait;
|
|
||||||
ULONG CcFastMdlReadResourceMiss;
|
|
||||||
ULONG CcFastMdlReadNotPossible;
|
|
||||||
ULONG CcMapDataNoWait;
|
|
||||||
ULONG CcMapDataWait;
|
|
||||||
ULONG CcMapDataNoWaitMiss;
|
|
||||||
ULONG CcMapDataWaitMiss;
|
|
||||||
ULONG CcPinMappedDataCount;
|
|
||||||
ULONG CcPinReadNoWait;
|
|
||||||
ULONG CcPinReadWait;
|
|
||||||
ULONG CcPinReadNoWaitMiss;
|
|
||||||
ULONG CcPinReadWaitMiss;
|
|
||||||
ULONG CcCopyReadNoWait;
|
|
||||||
ULONG CcCopyReadWait;
|
|
||||||
ULONG CcCopyReadNoWaitMiss;
|
|
||||||
ULONG CcCopyReadWaitMiss;
|
|
||||||
ULONG CcMdlReadNoWait;
|
|
||||||
ULONG CcMdlReadWait;
|
|
||||||
ULONG CcMdlReadNoWaitMiss;
|
|
||||||
ULONG CcMdlReadWaitMiss;
|
|
||||||
ULONG CcReadaheadIos;
|
|
||||||
ULONG CcLazyWriteIos;
|
|
||||||
ULONG CcLazyWritePages;
|
|
||||||
ULONG CcDataFlushes;
|
|
||||||
ULONG CcDataPages;
|
|
||||||
ULONG ContextSwitches;
|
|
||||||
ULONG Unknown13;
|
|
||||||
ULONG Unknown14;
|
|
||||||
ULONG SystemCalls;
|
|
||||||
|
|
||||||
} SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
LARGE_INTEGER liKeBootTime;
|
|
||||||
LARGE_INTEGER liKeSystemTime;
|
|
||||||
LARGE_INTEGER liExpTimeZoneBias;
|
|
||||||
ULONG uCurrentTimeZoneId;
|
|
||||||
DWORD dwReserved;
|
|
||||||
} SYSTEM_TIME_INFORMATION;
|
|
||||||
|
|
||||||
/* SystemCacheInformation (21) */
|
|
||||||
typedef struct _SYSTEM_CACHE_INFORMATION
|
|
||||||
{
|
|
||||||
ULONG CurrentSize;
|
|
||||||
ULONG PeakSize;
|
|
||||||
ULONG PageFaultCount;
|
|
||||||
ULONG MinimumWorkingSet;
|
|
||||||
ULONG MaximumWorkingSet;
|
|
||||||
ULONG Unused[4];
|
|
||||||
|
|
||||||
} SYSTEM_CACHE_INFORMATION;
|
|
||||||
|
|
||||||
/* SystemPageFileInformation (18) */
|
/* SystemPageFileInformation (18) */
|
||||||
typedef
|
typedef
|
||||||
struct _SYSTEM_PAGEFILE_INFORMATION
|
struct _SYSTEM_PAGEFILE_INFORMATION
|
||||||
@ -281,54 +58,8 @@ struct _SYSTEM_PAGEFILE_INFORMATION
|
|||||||
ULONG TotalUsedPages;
|
ULONG TotalUsedPages;
|
||||||
ULONG PeakUsedPages;
|
ULONG PeakUsedPages;
|
||||||
UNICODE_STRING PagefileFileName;
|
UNICODE_STRING PagefileFileName;
|
||||||
|
|
||||||
} SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION;
|
} SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION;
|
||||||
|
|
||||||
/* SystemHandleInformation (16) */
|
|
||||||
/* (see ontypes.h) */
|
|
||||||
typedef
|
|
||||||
struct _SYSTEM_HANDLE_ENTRY
|
|
||||||
{
|
|
||||||
ULONG OwnerPid;
|
|
||||||
BYTE ObjectType;
|
|
||||||
BYTE HandleFlags;
|
|
||||||
USHORT HandleValue;
|
|
||||||
PVOID ObjectPointer;
|
|
||||||
ULONG AccessMask;
|
|
||||||
|
|
||||||
} SYSTEM_HANDLE_ENTRY, *PSYSTEM_HANDLE_ENTRY;
|
|
||||||
|
|
||||||
typedef
|
|
||||||
struct _SYSTEM_HANDLE_INFORMATION
|
|
||||||
{
|
|
||||||
ULONG Count;
|
|
||||||
SYSTEM_HANDLE_ENTRY Handle [1];
|
|
||||||
|
|
||||||
} SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
|
|
||||||
|
|
||||||
/* SystemProcessorPerformanceInformation (8) */
|
|
||||||
typedef
|
|
||||||
struct _SYSTEM_PROCESSORTIME_INFO
|
|
||||||
{
|
|
||||||
LARGE_INTEGER IdleTime;
|
|
||||||
LARGE_INTEGER KernelTime;
|
|
||||||
LARGE_INTEGER UserTime;
|
|
||||||
LARGE_INTEGER DpcTime;
|
|
||||||
LARGE_INTEGER InterruptTime;
|
|
||||||
ULONG InterruptCount;
|
|
||||||
ULONG Unused;
|
|
||||||
|
|
||||||
} SYSTEM_PROCESSORTIME_INFO, *PSYSTEM_PROCESSORTIME_INFO;
|
|
||||||
|
|
||||||
#define SystemBasicInformation 0
|
|
||||||
#define SystemPerformanceInformation 2
|
|
||||||
#define SystemTimeInformation 3
|
|
||||||
#define SystemProcessInformation 5
|
|
||||||
#define SystemProcessorTimeInformation 8
|
|
||||||
#define SystemHandleInformation 16
|
|
||||||
#define SystemPageFileInformation 18
|
|
||||||
#define SystemCacheInformation 21
|
|
||||||
|
|
||||||
#define Li2Double(x) ((double)((x).QuadPart))
|
#define Li2Double(x) ((double)((x).QuadPart))
|
||||||
|
|
||||||
#define GR_GDIOBJECTS 0 /* Count of GDI objects */
|
#define GR_GDIOBJECTS 0 /* Count of GDI objects */
|
||||||
@ -339,7 +70,6 @@ typedef DWORD (WINAPI *PROCGGR)(HANDLE,DWORD);
|
|||||||
typedef BOOL (WINAPI *PROCGPIC)(HANDLE,PIO_COUNTERS);
|
typedef BOOL (WINAPI *PROCGPIC)(HANDLE,PIO_COUNTERS);
|
||||||
|
|
||||||
BOOL PerfDataInitialize(void);
|
BOOL PerfDataInitialize(void);
|
||||||
void PerfDataUninitialize(void);
|
|
||||||
void PerfDataRefresh(void);
|
void PerfDataRefresh(void);
|
||||||
|
|
||||||
ULONG PerfDataGetProcessCount(void);
|
ULONG PerfDataGetProcessCount(void);
|
||||||
@ -383,9 +113,4 @@ ULONG PerfDataGetSystemHandleCount(void);
|
|||||||
|
|
||||||
ULONG PerfDataGetTotalThreadCount(void);
|
ULONG PerfDataGetTotalThreadCount(void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __PERFDATA_H */
|
#endif /* __PERFDATA_H */
|
||||||
|
@ -1101,6 +1101,5 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||||||
|
|
||||||
/* Save our settings to the registry */
|
/* Save our settings to the registry */
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
PerfDataUninitialize();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user