From b9d7ecdc1a8c22bdf8bbef97e79f7c1e0903facc Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 10 Jul 2007 17:49:51 +0000 Subject: [PATCH] - client: run_if_user_active pref applies to both network transfers and CPU usage. (Note: maybe we should have a separate pref for this). svn path=/trunk/boinc/; revision=13131 --- checkin_notes | 9 +++++ client/client_state.C | 37 +++++++++++++++++++- client/client_state.h | 2 +- client/cs_prefs.C | 49 +++++--------------------- doc/docutil.php | 7 ++-- doc/index.php | 81 ++++++++++++++++++++++++------------------- doc/versions.inc | 17 ++++----- doc/white.css | 16 ++++++--- 8 files changed, 125 insertions(+), 93 deletions(-) diff --git a/checkin_notes b/checkin_notes index f0c97e69be..bc0a232a29 100755 --- a/checkin_notes +++ b/checkin_notes @@ -7142,3 +7142,12 @@ Charlie 10 July 2007 client/ cs_statefile.C + +David 10 July 2007 + - client: run_if_user_active pref applies to both + network transfers and CPU usage. + (Note: maybe we should have a separate pref for this). + + client/ + client_state.C,h + cs_prefs.C diff --git a/client/client_state.C b/client/client_state.C index eb673b844d..f5bfc942de 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -447,6 +447,9 @@ bool CLIENT_STATE::poll_slow_events() { static int last_suspend_reason=0; static bool tasks_restarted = false; double old_now = now; +#ifdef __APPLE__ + double idletime; +#endif now = dtime(); if (now - old_now > POLL_INTERVAL*10) { @@ -464,7 +467,39 @@ bool CLIENT_STATE::poll_slow_events() { start_cpu_benchmarks(); } - check_suspend_activities(suspend_reason); + bool old_user_active = user_active; + user_active = !host_info.users_idle( + check_all_logins, global_prefs.idle_time_to_run +#ifdef __APPLE__ + , &idletime +#endif + ); + + if (user_active != old_user_active) { + request_schedule_cpus("Idle state change"); + } +#ifdef __APPLE__ + // Mac screensaver launches client if not already running. + // OS X quits screensaver when energy saver puts display to sleep, + // but we want to keep crunching. + // Also, user can start Mac screensaver by putting cursor in "hot corner" + // so idletime may be very small initially. + // If screensaver started client, this code tells client + // to exit when user becomes active, accounting for all these factors. + // + if (started_by_screensaver && (idletime < 30) && (getppid() == 1)) { + // pid is 1 if parent has exited + requested_exit = true; + } + + // Exit if we were launched by Manager and it crashed. + // + if (launched_by_manager && (getppid() == 1)) { + gstate.requested_exit = true; + } +#endif + + check_suspend_processing(suspend_reason); // suspend or resume activities (but only if already did startup) // diff --git a/client/client_state.h b/client/client_state.h index 0d397692d4..671a879297 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -391,7 +391,7 @@ public: double available_ram(); double max_available_ram(); private: - void check_suspend_activities(int&); + void check_suspend_processing(int&); void check_suspend_network(int&); void install_global_prefs(); PROJECT* global_prefs_source_project(); diff --git a/client/cs_prefs.C b/client/cs_prefs.C index d56c9b2789..1870ecd9af 100644 --- a/client/cs_prefs.C +++ b/client/cs_prefs.C @@ -106,13 +106,11 @@ int CLIENT_STATE::allowed_project_disk_usage(double& size) { #endif // See if (on the basis of user run request and prefs) -// we should suspend activities. +// we should suspend processing // -void CLIENT_STATE::check_suspend_activities(int& reason) { +void CLIENT_STATE::check_suspend_processing(int& reason) { reason = 0; -#ifdef __APPLE__ - double idletime; -#endif + // Don't work while we're running CPU benchmarks // if (are_cpu_benchmarks_running()) { @@ -120,39 +118,6 @@ void CLIENT_STATE::check_suspend_activities(int& reason) { return; } - bool old_user_active = user_active; - user_active = !host_info.users_idle( - check_all_logins, global_prefs.idle_time_to_run -#ifdef __APPLE__ - , &idletime -#endif - ); - - if (user_active != old_user_active) { - request_schedule_cpus("Idle state change"); - } -#ifdef __APPLE__ - // Mac screensaver launches client if not already running. - // OS X quits screensaver when energy saver puts display to sleep, - // but we want to keep crunching. - // Also, user can start Mac screensaver by putting cursor in "hot corner" - // so idletime may be very small initially. - // If screensaver started client, this code tells client - // to exit when user becomes active, accounting for all these factors. - // - if (started_by_screensaver && (idletime < 30) && (getppid() == 1)) { - // pid is 1 if parent has exited - requested_exit = true; - } - - // Exit if we were launched by Manager and it crashed. - if (launched_by_manager) { - // pid is 1 if parent no longer running - if (getppid() == 1) - gstate.requested_exit = true; - } -#endif - switch(run_mode.get_current()) { case RUN_MODE_ALWAYS: break; case RUN_MODE_NEVER: @@ -252,11 +217,15 @@ void CLIENT_STATE::check_suspend_network(int& reason) { switch(network_mode.get_current()) { case RUN_MODE_ALWAYS: return; case RUN_MODE_NEVER: - reason |= SUSPEND_REASON_USER_REQ; + reason = SUSPEND_REASON_USER_REQ; + return; + } + if (!global_prefs.run_if_user_active && user_active) { + reason = SUSPEND_REASON_USER_ACTIVE; return; } if (global_prefs.suspended_time_of_day(PREFS_NETWORK)) { - reason |= SUSPEND_REASON_TIME_OF_DAY; + reason = SUSPEND_REASON_TIME_OF_DAY; } return; } diff --git a/doc/docutil.php b/doc/docutil.php index 014eba27ea..059fe406eb 100644 --- a/doc/docutil.php +++ b/doc/docutil.php @@ -1,12 +1,13 @@ + echo " +
- - + +
"; diff --git a/doc/index.php b/doc/index.php index 9cd4116fd1..8bd08fe22e 100644 --- a/doc/index.php +++ b/doc/index.php @@ -30,7 +30,7 @@ function show_news_items() { require_once("boinc_news.php"); require_once("../html/inc/news.inc"); echo " -
+ "; } @@ -81,16 +74,17 @@ function show_create() { echo "
News
"; @@ -65,13 +65,6 @@ function show_participate() { ".sprintf(tr(HOME_P2), "", "", "", "", "", "")."

".sprintf(tr(HOME_P3), "", "")." -

- ".tr(HOME_DOWNLOAD)." - | ".tr(HOME_MORE_INFO)." - | ".tr(HOME_WEB_SITES)." - | ".tr(HOME_ADD_ONS)." - | ".tr(HOME_SURVEY)." -
Compute with BOINC
- A BOINC project with a single Linux server - can provide computing power equivalent - to a cluster with tens of thousands of CPUs. Learn how to create and operate a BOINC project.
  • Scientists: if your group has moderate programming, web, sysadmin, and hardware resources, you can create your own BOINC project. - Or organizations such as IBM World Community Grid may be able + A BOINC project with a single Linux server + can provide computing power equivalent + to a cluster with tens of thousands of CPUs. +
  • + Organizations such as IBM World Community Grid may be able to host your project (please contact us for information).
  • Universities: use BOINC to create a @@ -140,6 +134,36 @@ function show_nsf() { "; } +function language_form() { + echo " +
    + +
    + + "; +} + html_tag(); if (defined("CHARSET")) { header("Content-type: text/html; charset=".tr(CHARSET)); @@ -162,32 +186,19 @@ echo " ".sprintf(tr(HOME_BOINC_DESC), '', '', '', '')."

    +
    +
    +".tr(HOME_DOWNLOAD)." +| ".tr(HOME_MORE_INFO)." +| ".tr(HOME_WEB_SITES)." +| ".tr(HOME_ADD_ONS)." +| ".tr(HOME_SURVEY)." + "; +language_form(); search_form(); echo " -
    - -العربية -| Беларускі -| Български -| Català -| Deutsch -| English -| Español -| Français -| 日本語 -"; -//| 日本語 -echo " -| Lietuvių -| Polski -| Português - Brasil -| Русский -| Slovenčina -| Türkçe -| 简体中文 -| Browser - +
    diff --git a/doc/versions.inc b/doc/versions.inc index 874e31f314..1d2c66bcf9 100644 --- a/doc/versions.inc +++ b/doc/versions.inc @@ -715,14 +715,15 @@ function is_dev($v) { return (strstr($v["status"], "Development") != null); } -switch(rand(0,5)) { - case 0: $url_base = "http://boinc.berkeley.edu/dl/"; break; - case 1: $url_base = "http://morel.mit.edu/download/boinc/dl/"; break; - case 2: $url_base = "http://einstein.aei.mpg.de/download/boinc/dl/"; break; - case 3: $url_base = "http://einstein.astro.gla.ac.uk/download/boinc/dl/"; break; - case 4: $url_base = "http://albert.gravity.psu.edu/download/boinc/dl/"; break; - case 5: $url_base = "http://einstein.ligo.caltech.edu/download/boinc/dl/"; break; +$url_base = "http://boincdl.ssl.berkeley.edu/dl/"; +//switch(rand(0,5)) { + //case 0: $url_base = "http://boinc.berkeley.edu/dl/"; break; + //case 1: $url_base = "http://morel.mit.edu/download/boinc/dl/"; break; + //case 2: $url_base = "http://einstein.aei.mpg.de/download/boinc/dl/"; break; + //case 3: $url_base = "http://einstein.astro.gla.ac.uk/download/boinc/dl/"; break; + //case 4: $url_base = "http://albert.gravity.psu.edu/download/boinc/dl/"; break; + //case 5: $url_base = "http://einstein.ligo.caltech.edu/download/boinc/dl/"; break; //case 6: $url_base = "http://einstein.phys.uwm.edu/download/boinc/dl/"; break; -} +//} ?> diff --git a/doc/white.css b/doc/white.css index c76023956f..7af88fcc1b 100644 --- a/doc/white.css +++ b/doc/white.css @@ -14,28 +14,24 @@ code { a:link { color: blue; text-decoration: none; -#font-weight: bold; } a:visited { color: blue; text-decoration: none; -#font-weight: bold; } a:active { color: blue; -#font-weight: bold; } a:hover { color: rgb(200,80,80); -#font-weight: bold; } body , table , input , select { font-family: "Trebuchet MS", Verdana, Arial, Sans Serif; -#font-size: small; +#font-size: 16px; } table.box { @@ -115,3 +111,13 @@ img { font-size: 80%; font-weight: normal; } + +select.selectbox { + font-size: 12px; + height:20px; +} + +input.small { + font-size: 12px; + height:22px; +}