client: Add code for determining non-BOINC CPU time for GR and PtP clients (Mac & Windows)

svn path=/trunk/boinc/; revision=21170
This commit is contained in:
Charlie Fenton 2010-04-13 09:40:22 +00:00
parent ab7df01162
commit 97333885a0
1 changed files with 9 additions and 29 deletions

View File

@ -9,11 +9,6 @@
using std::vector; using std::vector;
// Possible values of iBrandId:
#define BOINC_BRAND_ID 0
#define GRIDREPUBLIC_BRAND_ID 1
#define PROGRESSTHRUPROCESSORS_BRAND_ID 2
// NtQuerySystemInformation // NtQuerySystemInformation
typedef NTSTATUS (WINAPI *tNTQSI)( typedef NTSTATUS (WINAPI *tNTQSI)(
ULONG SystemInformationClass, ULONG SystemInformationClass,
@ -74,22 +69,10 @@ int get_procinfo_XP(vector<PROCINFO>& pi) {
PVOID pBuffer = NULL; PVOID pBuffer = NULL;
PSYSTEM_PROCESSES pProcesses = NULL; PSYSTEM_PROCESSES pProcesses = NULL;
static DWORD pid = 0; static DWORD pid = 0;
static long iBrandID = -1;
if (!pid) { if (!pid) {
pid = GetCurrentProcessId(); pid = GetCurrentProcessId();
} }
if (iBrandID < 0) {
iBrandID = BOINC_BRAND_ID;
if (boinc_file_exists("gridrepublic.exe")) {
iBrandID = GRIDREPUBLIC_BRAND_ID;
} else
if (boinc_file_exists("progressthruprocessors.exe")) {
iBrandID = PROGRESSTHRUPROCESSORS_BRAND_ID;
}
}
#if 0 #if 0
printf("FILETIME: %d\n", sizeof(FILETIME)); printf("FILETIME: %d\n", sizeof(FILETIME));
printf("LARGE_INTEGER: %d\n", sizeof(LARGE_INTEGER)); printf("LARGE_INTEGER: %d\n", sizeof(LARGE_INTEGER));
@ -122,19 +105,16 @@ int get_procinfo_XP(vector<PROCINFO>& pi) {
); );
p.is_boinc_app = (p.id == pid) || (strcasestr(p.command, "boinc") != NULL); p.is_boinc_app = (p.id == pid) || (strcasestr(p.command, "boinc") != NULL);
switch (iBrandID) { #ifdef _GRIDREPUBLIC
case GRIDREPUBLIC_BRAND_ID: if (strcasestr(p.command, "gridrepublic") != NULL) {
if (strcasestr(p.command, "gridrepublic") != NULL) { p.is_boinc_app = true;
p.is_boinc_app = true;
}
break;
case PROGRESSTHRUPROCESSORS_BRAND_ID:
if (strcasestr(p.command, "progressthruprocessors") != NULL) {
p.is_boinc_app = true;
}
break;
} }
#endif
ifdef _PROGRESSTHRUPROCESSORS
if (strcasestr(p.command, "progressthruprocessors") != NULL) {
p.is_boinc_app = true;
}
#endif
pi.push_back(p); pi.push_back(p);
if (!pProcesses->NextEntryDelta) { if (!pProcesses->NextEntryDelta) {
break; break;