diff --git a/checkin_notes b/checkin_notes index cdc5ca0140..3a6cf21a4d 100644 --- a/checkin_notes +++ b/checkin_notes @@ -2741,3 +2741,11 @@ David 10 Apr 2010 sched/ sched_version.cpp sched_send.cpp + +Charlie 13 Apr 2010 + - client: Add code for determining non-BOINC CPU time for GridRepublic + and Progress Thru Processors clients (Mac & Windows). + + lib/ + procinfo_mac.cpp + procinfo_win.cpp diff --git a/lib/procinfo_mac.cpp b/lib/procinfo_mac.cpp index 1e80236503..11221bcb5f 100644 --- a/lib/procinfo_mac.cpp +++ b/lib/procinfo_mac.cpp @@ -34,6 +34,11 @@ using std::vector; +// Possible values of iBrandId: +#define BOINC_BRAND_ID 0 +#define GRIDREPUBLIC_BRAND_ID 1 +#define PROGRESSTHRUPROCESSORS_BRAND_ID 2 + // build table of all processes in system // @@ -43,6 +48,19 @@ int procinfo_setup(vector& pi) { PROCINFO p; int c, real_mem, virtual_mem, hours; char* lf; + static long iBrandID = -1; + + if (iBrandID < 0) { + iBrandID = BOINC_BRAND_ID; + + // For GridRepublic or ProgressThruProcessors, the Mac + // installer put a branding file in our data directory + FILE *f = fopen("/Library/Application Support/BOINC Data/Branding", "r"); + if (f) { + fscanf(f, "BrandId=%ld\n", &iBrandID); + fclose(f); + } + } #if SHOW_TIMING UnsignedWide start, end, elapsed; @@ -107,6 +125,19 @@ int procinfo_setup(vector& pi) { p.swap_size = (double)virtual_mem * 1024.; p.user_time += 60. * (float)hours; p.is_boinc_app = (p.id == pid || strcasestr(p.command, "boinc")); + + switch (iBrandID) { + case GRIDREPUBLIC_BRAND_ID: + if (strcasestr(p.command, "GridRepublic")) { + p.is_boinc_app = true; + } + break; + case PROGRESSTHRUPROCESSORS_BRAND_ID: + if (strcasestr(p.command, "Progress Thru Processors")) { + p.is_boinc_app = true; + } + break; + } pi.push_back(p); } @@ -145,7 +176,7 @@ void add_proc_totals(PROCINFO& pi, vector& piv, int pid, char* graphic } // look for child process of this one if (p.parentid == pid) { - add_proc_totals(pi, piv, p.id, graphics_exec_file, i+1); // recursion - woo hoo! + add_proc_totals(pi, piv, p.id, graphics_exec_file, i+1, rlvl+1); // recursion - woo hoo! } } } diff --git a/lib/procinfo_win.cpp b/lib/procinfo_win.cpp index 9e35845d69..123f55e915 100644 --- a/lib/procinfo_win.cpp +++ b/lib/procinfo_win.cpp @@ -9,6 +9,11 @@ using std::vector; +// Possible values of iBrandId: +#define BOINC_BRAND_ID 0 +#define GRIDREPUBLIC_BRAND_ID 1 +#define PROGRESSTHRUPROCESSORS_BRAND_ID 2 + // NtQuerySystemInformation typedef NTSTATUS (WINAPI *tNTQSI)( ULONG SystemInformationClass, @@ -68,11 +73,23 @@ int get_procinfo_XP(vector& pi) { ULONG cbBuffer = 128*1024; // 128k initial buffer PVOID pBuffer = NULL; PSYSTEM_PROCESSES pProcesses = NULL; - static DWORD pid = 0; + static DWORD pid = 0; + static long iBrandID = -1; if (!pid) { 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 printf("FILETIME: %d\n", sizeof(FILETIME)); printf("LARGE_INTEGER: %d\n", sizeof(LARGE_INTEGER)); @@ -104,6 +121,20 @@ int get_procinfo_XP(vector& pi) { NULL, NULL ); p.is_boinc_app = (p.id == pid) || (strcasestr(p.command, "boinc") != NULL); + + switch (iBrandID) { + case GRIDREPUBLIC_BRAND_ID: + if (strcasestr(p.command, "gridrepublic") != NULL) { + p.is_boinc_app = true; + } + break; + case PROGRESSTHRUPROCESSORS_BRAND_ID: + if (strcasestr(p.command, "progressthruprocessors") != NULL) { + p.is_boinc_app = true; + } + break; + } + pi.push_back(p); if (!pProcesses->NextEntryDelta) { break;