*** empty log message ***

svn path=/trunk/boinc/; revision=11439
This commit is contained in:
David Anderson 2006-11-01 22:40:30 +00:00
parent e37826157d
commit 0257e48e2f
3 changed files with 28 additions and 9 deletions

View File

@ -11964,3 +11964,12 @@ Rom 1 Nov 2006
lib/
gui_rpc_client_ops.C
David 1 Nov 2006
- core client: check error returns in Win code to
find app memory usage.
client/
app.C
lib/
procinfo_win.C

View File

@ -196,13 +196,22 @@ void ACTIVE_TASK_SET::free_mem() {
void ACTIVE_TASK_SET::get_memory_usage() {
static double last_mem_time=0;
unsigned int i;
int retval;
double diff = gstate.now - last_mem_time;
if (diff < 10) return;
last_mem_time = gstate.now;
vector<PROCINFO> piv;
procinfo_setup(piv);
retval = procinfo_setup(piv);
if (retval) {
if (log_flags.mem_usage_debug) {
msg_printf(0, MSG_ERROR,
"[mem_usage_debug] procinfo_setup() returned %d", retval
);
}
return;
}
for (i=0; i<active_tasks.size(); i++) {
ACTIVE_TASK* atp = active_tasks[i];
if (atp->task_state == PROCESS_EXECUTING) {

View File

@ -1,3 +1,4 @@
#include "error_numbers.h"
#include "diagnostics_win.h"
#include "procinfo.h"
@ -12,7 +13,6 @@ typedef NTSTATUS (WINAPI *tNTQSI)(
);
static int get_process_information(PVOID* ppBuffer, PULONG pcbBuffer) {
int retval = 0;
NTSTATUS Status = STATUS_INFO_LENGTH_MISMATCH;
HANDLE hHeap = GetProcessHeap();
HMODULE hNTDllLib = NULL;
@ -21,10 +21,10 @@ static int get_process_information(PVOID* ppBuffer, PULONG pcbBuffer) {
hNTDllLib = GetModuleHandle("ntdll.dll");
pNTQSI = (tNTQSI)GetProcAddress(hNTDllLib, "NtQuerySystemInformation");
do {
while (1) {
*ppBuffer = HeapAlloc(hHeap, HEAP_ZERO_MEMORY, *pcbBuffer);
if (ppBuffer == NULL) {
retval = ERROR_NOT_ENOUGH_MEMORY;
return ERR_MALLOC;
}
Status = pNTQSI(
@ -39,11 +39,12 @@ static int get_process_information(PVOID* ppBuffer, PULONG pcbBuffer) {
*pcbBuffer *= 2;
} else if (!NT_SUCCESS(Status)) {
HeapFree(hHeap, NULL, *ppBuffer);
retval = Status;
}
} while (Status == STATUS_INFO_LENGTH_MISMATCH);
return retval;
return ERR_GETRUSAGE;
} else {
return 0;
}
}
return 0; // never reached
}
// Note: the following will work on both NT and XP,