From 9b2998009f2535fe59bc98bdec7242f6be3435dc Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 27 Dec 2007 21:40:20 +0000 Subject: [PATCH] - client: add --start_delay cmdline option and config option. Specifies an amount of time to delay starting apps (e.g. so that BOINC doesn't slow down boot process) Note: mechanisms that start BOINC at boot time need to figure out how to set this flag. svn path=/trunk/boinc/; revision=14445 --- checkin_notes | 19 ++++++++++++++++++- client/client_state.C | 1 + client/client_state.h | 1 + client/cs_cmdline.C | 5 +++++ client/cs_prefs.C | 10 +++++----- client/hostinfo_network.C | 4 ++++ client/log_flags.C | 2 ++ client/log_flags.h | 1 + lib/common_defs.h | 3 ++- 9 files changed, 39 insertions(+), 7 deletions(-) diff --git a/checkin_notes b/checkin_notes index 7623503fc4..37260f48ae 100644 --- a/checkin_notes +++ b/checkin_notes @@ -12521,7 +12521,7 @@ David 24 Dec 2007 sched/ sched_send.C -David 24 Dec 2007 +David 27 Dec 2007 - web: default for user_links() is to not show profile pic. Show the pic only in the context of friends list. @@ -12532,3 +12532,20 @@ David 24 Dec 2007 user.inc user/ friend.php + +David 27 Dec 2007 + - client: add --start_delay cmdline option and config option. + Specifies an amount of time to delay starting apps + (e.g. so that BOINC doesn't slow down boot process) + + Note: mechanisms that start BOINC at boot time + need to figure out how to set this flag. + + client/ + client_state.C,h + cs_cmdline.C + cs_prefs.C + hostinfo_network.C + log_flags.C,h + lib/ + common_defs.h diff --git a/client/client_state.C b/client/client_state.C index 2f6f8f078a..22a73f282f 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -163,6 +163,7 @@ int CLIENT_STATE::init() { srand((unsigned int)time(0)); now = dtime(); + client_start_time = now; scheduler_op->url_random = drand(); detect_platforms(); diff --git a/client/client_state.h b/client/client_state.h index 4ca567119f..b8efff383b 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -156,6 +156,7 @@ public: // this affects auto-update bool run_by_updater; double now; + double client_start_time; double last_wakeup_time; bool initialized; bool cant_write_state_file; diff --git a/client/cs_cmdline.C b/client/cs_cmdline.C index 407028a532..649333f478 100644 --- a/client/cs_cmdline.C +++ b/client/cs_cmdline.C @@ -63,6 +63,7 @@ static void print_options(char* prog) { " --insecure disable app sandboxing (Unix)\n" " --launched_by_manager core client was launched by Manager\n" " --run_by_updater set by updater\n" + " --start_delay X delay starting apps for X secs\n" , prog, prog, prog ); @@ -86,6 +87,7 @@ void CLIENT_STATE::parse_cmdline(int argc, char** argv) { for (i=1; ih_addr_list[0]) { diff --git a/client/log_flags.C b/client/log_flags.C index b049170d6f..d38c50439e 100644 --- a/client/log_flags.C +++ b/client/log_flags.C @@ -204,6 +204,7 @@ void CONFIG::defaults() { max_stderr_file_size = 0; alt_platforms.clear(); report_results_immediately = false; + start_delay = 0; } int CONFIG::parse_options(XML_PARSER& xp) { @@ -247,6 +248,7 @@ int CONFIG::parse_options(XML_PARSER& xp) { if (xp.parse_int(tag, "max_stdout_file_size", max_stdout_file_size)) continue; if (xp.parse_int(tag, "max_stderr_file_size", max_stderr_file_size)) continue; if (xp.parse_bool(tag, "report_results_immediately", report_results_immediately)) continue; + if (xp.parse_double(tag, "start_delay", start_delay)) continue; msg_printf(NULL, MSG_USER_ERROR, "Unparsed tag in %s: <%s>\n", CONFIG_FILE, tag ); diff --git a/client/log_flags.h b/client/log_flags.h index 5214a66767..c845f4ea94 100644 --- a/client/log_flags.h +++ b/client/log_flags.h @@ -101,6 +101,7 @@ struct CONFIG { int max_stdout_file_size; int max_stderr_file_size; bool report_results_immediately; + double start_delay; CONFIG(); void defaults(); diff --git a/lib/common_defs.h b/lib/common_defs.h index 96b76b6e92..eeec6e2a6d 100644 --- a/lib/common_defs.h +++ b/lib/common_defs.h @@ -110,7 +110,8 @@ enum SUSPEND_REASON { SUSPEND_REASON_BENCHMARKS = 16, SUSPEND_REASON_DISK_SIZE = 32, SUSPEND_REASON_CPU_USAGE_LIMIT = 64, - SUSPEND_REASON_NO_RECENT_INPUT = 128 + SUSPEND_REASON_NO_RECENT_INPUT = 128, + SUSPEND_REASON_INITIAL_DELAY = 256, }; // States of a result on a client.