- Get memory measurements to work on Win64.

The format of a process descriptor had changed a little,
        and the format of the VM stats part was completely changed.
        I had to reverse engineer it - very unpleasant.

    lib/
        diagnostics_sin.h
        procinfo.h

svn path=/trunk/boinc/; revision=12804
This commit is contained in:
David Anderson 2007-06-01 22:34:47 +00:00
parent acf10435c9
commit 60f3e05410
3 changed files with 42 additions and 1 deletions

View File

@ -5672,3 +5672,13 @@ Rom 1 June 2007
win_build/installerv2/redist/Windows/x64/
boinccas.dll
boinccas95.dll
David 1 June 2007
- Get memory measurements to work on Win64.
The format of a process descriptor had changed a little,
and the format of the VM stats part was completely changed.
I had to reverse engineer it - very unpleasant.
lib/
diagnostics_sin.h
procinfo.h

View File

@ -40,6 +40,20 @@ typedef struct _UNICODE_STRING {
} UNICODE_STRING;
typedef struct _VM_COUNTERS {
#ifdef _WIN64
// the following was inferred by painful reverse engineering
SIZE_T PeakVirtualSize; // not actually
SIZE_T PageFaultCount;
SIZE_T PeakWorkingSetSize;
SIZE_T WorkingSetSize;
SIZE_T QuotaPeakPagedPoolUsage;
SIZE_T QuotaPagedPoolUsage;
SIZE_T QuotaPeakNonPagedPoolUsage;
SIZE_T QuotaNonPagedPoolUsage;
SIZE_T PagefileUsage;
SIZE_T PeakPagefileUsage;
SIZE_T VirtualSize; // not actually
#else
SIZE_T PeakVirtualSize;
SIZE_T VirtualSize;
ULONG PageFaultCount;
@ -51,6 +65,7 @@ typedef struct _VM_COUNTERS {
SIZE_T QuotaNonPagedPoolUsage;
SIZE_T PagefileUsage;
SIZE_T PeakPagefileUsage;
#endif
} VM_COUNTERS;
typedef struct _SYSTEM_THREADS {
@ -93,8 +108,16 @@ typedef struct _SYSTEM_PROCESSES {
LARGE_INTEGER KernelTime;
UNICODE_STRING ProcessName;
KPRIORITY BasePriority;
#ifdef _WIN64
ULONG pad1;
ULONG ProcessId;
ULONG pad2;
ULONG InheritedFromProcessId;
ULONG pad3, pad4, pad5;
#else
ULONG ProcessId;
ULONG InheritedFromProcessId;
#endif
ULONG HandleCount;
ULONG Reserved2[2];
VM_COUNTERS VmCounters;

View File

@ -62,6 +62,15 @@ int get_procinfo_XP(vector<PROCINFO>& pi) {
ULONG cbBuffer = 128*1024; // 128k initial buffer
PVOID pBuffer = NULL;
PSYSTEM_PROCESSES pProcesses = NULL;
#if 0
printf("FILETIME: %d\n", sizeof(FILETIME));
printf("LARGE_INTEGER: %d\n", sizeof(LARGE_INTEGER));
printf("DWORD: %d\n", sizeof(DWORD));
printf("UNICODE_STRING: %d\n", sizeof(UNICODE_STRING));
printf("KPRIORITY: %d\n", sizeof(KPRIORITY));
printf("ULONG: %d\n", sizeof(ULONG));
printf("SIZE_T: %d\n", sizeof(SIZE_T));
#endif
get_process_information(&pBuffer, &cbBuffer);
pProcesses = (PSYSTEM_PROCESSES)pBuffer;
@ -78,7 +87,6 @@ int get_procinfo_XP(vector<PROCINFO>& pi) {
p.parentid = pProcesses->InheritedFromProcessId;
p.is_boinc_app = false;
pi.push_back(p);
if (!pProcesses->NextEntryDelta) {
break;
}