From 270c583dcf2a1d51e571999af85d20dde737a3f9 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 12 Oct 2005 18:40:53 +0000 Subject: [PATCH] app version in window title svn path=/trunk/boinc/; revision=8663 --- api/graphics_impl.C | 14 ++++++++++++++ api/graphics_impl.h | 1 + api/windows_opengl.C | 8 +------- api/x_opengl.C | 8 +------- checkin_notes | 28 ++++++++++++++++++++++++++++ client/app_start.C | 1 + client/cs_scheduler.C | 5 +++-- doc/tool_xadd.php | 16 ++++++++++++++-- lib/app_ipc.C | 7 +++++-- lib/app_ipc.h | 1 + sched/server_types.C | 10 +++++++--- tools/add | 3 +++ tools/xadd | 18 ++++++++++++++++++ 13 files changed, 97 insertions(+), 23 deletions(-) diff --git a/api/graphics_impl.C b/api/graphics_impl.C index cae1c97872..992d643066 100755 --- a/api/graphics_impl.C +++ b/api/graphics_impl.C @@ -238,4 +238,18 @@ bool throttled_app_render(int x, int y, double t) { return false; } +void get_window_title(APP_INIT_DATA& aid, char* buf, int len) { + if (aid.app_version) { + snprintf(buf, len, + "%s version %d [workunit: %s]", + aid.app_name, aid.app_version, aid.wu_name + ); + } else { + snprintf(buf, len, + "%s [workunit: %s]", + aid.app_name, aid.wu_name + ); + } +} + const char *BOINC_RCSID_6e92742852 = "$Id$"; diff --git a/api/graphics_impl.h b/api/graphics_impl.h index 4eefb2b998..ef67d6acf6 100644 --- a/api/graphics_impl.h +++ b/api/graphics_impl.h @@ -56,3 +56,4 @@ extern "C" { } extern BOINC_MAIN_STATE* g_bmsp; +extern void get_window_title(APP_INIT_DATA& aid, char* buf, int len); diff --git a/api/windows_opengl.C b/api/windows_opengl.C index 5f85178852..f69cccf182 100755 --- a/api/windows_opengl.C +++ b/api/windows_opengl.C @@ -137,13 +137,7 @@ static void make_new_window() { boinc_get_init_data(aid); if (!strlen(aid.app_name)) strcpy(aid.app_name, "BOINC Application"); char window_title[256]; - // keep following consistent with similar code in x_opengl.C - // TODO: add app_version_num to window title. David or Rom, could - // you add app_version_num to struct APP_INIT_DATA? - // - snprintf(window_title, 256, - "%s [workunit: %s]", aid.app_name, aid.wu_name - ); + get_window_title(aid, window_title, 256); hWnd = CreateWindowEx(dwExStyle, BOINC_WINDOW_CLASS_NAME, window_title, dwStyle|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, WindowRect.left, WindowRect.top, WindowRect.right-WindowRect.left,WindowRect.bottom-WindowRect.top, diff --git a/api/x_opengl.C b/api/x_opengl.C index b4d5defa92..c166282813 100644 --- a/api/x_opengl.C +++ b/api/x_opengl.C @@ -154,13 +154,7 @@ static void make_new_window(int mode) { app_debug_msg("make_new_window(): now calling glutCreateWindow(%s)...\n", aid.app_name); char window_title[256]; - // keep following consistent with similar code in windows_opengl.C - // TODO: add app_version_num to window title. David or Rom, could - // you add app_version_num to struct APP_INIT_DATA? - // - snprintf(window_title, 256, - "%s version [workunit: %s]", aid.app_name, aid.wu_name - ); + get_window_title(aid, window_title, 256); win = glutCreateWindow(window_title); app_debug_msg("glutCreateWindow() succeeded. win = %d\n", win); diff --git a/checkin_notes b/checkin_notes index 76babadaf2..e1a998bc15 100755 --- a/checkin_notes +++ b/checkin_notes @@ -13036,3 +13036,31 @@ Charlie 12 Oct 2005 mac_installer/ ReadMe.rtf + +David 12 Oct 2005 + - scripts: disable "add", add comments to "xadd" + - Client: make "Communication deferred" message INFO rather than ERROR + + client/ + cs_scheduler.C + sched/ + server_types.C + tools/ + add + xadd + +David 12 Oct 2005 + - Add app version # to window title: + - add app_version to APP_INIT_DATA structure + - initialize it in ACTIVE_TASK::write_app_init_data_file() + - make new function get_window_title() so we don't have + to worry about consistency of X/WIn code + + api/ + graphics_impl.C,h + windows_opengl.C + x_opengl.C + client/ + app_start.C + lib/ + app_ipc.C,h diff --git a/client/app_start.C b/client/app_start.C index 87c9f9a8c2..fcd5e1bdae 100644 --- a/client/app_start.C +++ b/client/app_start.C @@ -145,6 +145,7 @@ int ACTIVE_TASK::write_app_init_file() { aid.major_version = BOINC_MAJOR_VERSION; aid.minor_version = BOINC_MINOR_VERSION; aid.release = BOINC_RELEASE; + aid.app_version = app_version->version_num; safe_strcpy(aid.app_name, wup->app->name); safe_strcpy(aid.user_name, wup->project->user_name); safe_strcpy(aid.team_name, wup->project->team_name); diff --git a/client/cs_scheduler.C b/client/cs_scheduler.C index 692da9be8c..8a6ba53dbf 100644 --- a/client/cs_scheduler.C +++ b/client/cs_scheduler.C @@ -97,7 +97,7 @@ bool PROJECT::waiting_until_min_rpc_time() { if (gstate.now >= min_report_min_rpc_time) { min_report_min_rpc_time = gstate.now + SECONDS_BEFORE_REPORTING_MIN_RPC_TIME_AGAIN; msg_printf( - this, MSG_ERROR, + this, MSG_INFO, "Deferring communication with project for %s\n", timediff_format(min_rpc_time - gstate.now).c_str() ); @@ -1030,7 +1030,8 @@ int CLIENT_STATE::handle_scheduler_reply( } bool CLIENT_STATE::should_get_work() { - // if there are fewer wus available then CPUS, then we need more work. + // if there are fewer runnable results then CPUS, we need more work. + // if (no_work_for_a_cpu()) return true; double tot_cpu_time_remaining = 0; diff --git a/doc/tool_xadd.php b/doc/tool_xadd.php index f26e3f10e5..b04ff78445 100644 --- a/doc/tool_xadd.php +++ b/doc/tool_xadd.php @@ -24,8 +24,20 @@ The contents of project.xml should look like this: ... - windows_intel - Windows 95, 98, NT 2000, and XP + anonymous + anonymous + + + i686-pc-linux-gnu + Linux/x86 + + + windows_intelx86 + Windows/x86 + + + powerpc-apple-darwin + Mac OS X ... diff --git a/lib/app_ipc.C b/lib/app_ipc.C index a41a6fd1bd..2e0abeaac6 100755 --- a/lib/app_ipc.C +++ b/lib/app_ipc.C @@ -82,10 +82,12 @@ int write_init_data_file(FILE* f, APP_INIT_DATA& ai) { "\n" "%d\n" "%d\n" - "%d\n", + "%d\n" + "%d\n", ai.major_version, ai.minor_version, - ai.release + ai.release, + ai.app_version ); if (strlen(ai.app_name)) { fprintf(f, "%s\n", ai.app_name); @@ -183,6 +185,7 @@ int parse_init_data_file(FILE* f, APP_INIT_DATA& ai) { else if (parse_int(buf, "", ai.major_version)) continue; else if (parse_int(buf, "", ai.minor_version)) continue; else if (parse_int(buf, "", ai.release)) continue; + else if (parse_int(buf, "", ai.app_version)) continue; else if (parse_str(buf, "", ai.app_name, sizeof(ai.app_name))) continue; else if (parse_str(buf, "", ai.user_name, sizeof(ai.user_name))) continue; else if (parse_str(buf, "", ai.team_name, sizeof(ai.team_name))) continue; diff --git a/lib/app_ipc.h b/lib/app_ipc.h index 47fa5c3a32..4c38e7f9d4 100755 --- a/lib/app_ipc.h +++ b/lib/app_ipc.h @@ -159,6 +159,7 @@ struct APP_INIT_DATA { int major_version; int minor_version; int release; + int app_version; char app_name[256]; char* project_preferences; int userid; diff --git a/sched/server_types.C b/sched/server_types.C index ba014d2941..db88884d39 100644 --- a/sched/server_types.C +++ b/sched/server_types.C @@ -404,9 +404,13 @@ int SCHEDULER_REPLY::write(FILE* fout) { // If this is less than one second bigger, bump up by one sec. // if (request_delay || config.min_sendwork_interval) { - double min_delay_needed=1.01*config.min_sendwork_interval; - if (min_delay_needed%f\n", request_delay); log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, "sending delay request %f\n", request_delay diff --git a/tools/add b/tools/add index 71413651a3..69abe40ef6 100755 --- a/tools/add +++ b/tools/add @@ -1,5 +1,8 @@ #!/usr/bin/env python +print "add is deprecated. Use xadd instead.\n" +raise SystemExit + # $Id$ diff --git a/tools/xadd b/tools/xadd index ee1903d4f9..4e2ee1ee7c 100755 --- a/tools/xadd +++ b/tools/xadd @@ -2,6 +2,24 @@ # $Id$ +''' +Add platform and application records to the BOINC database. +Reads info from "project.xml", e.g.: + + + + i686-pc-linux-gnu + Linux/x86 + + + astropulse + AstroPulse + + + +See http://boinc.berkeley.edu/tool_xadd.php +''' + import database, db_mid, projectxml database.connect()