- 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
This commit is contained in:
David Anderson 2007-07-10 17:49:51 +00:00
parent 05debbadf4
commit b9d7ecdc1a
8 changed files with 125 additions and 93 deletions

View File

@ -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

View File

@ -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)
//

View File

@ -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();

View File

@ -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;
}

View File

@ -1,12 +1,13 @@
<?php
function search_form() {
echo "<form method=get action=http://google.com/search>
echo "
<form method=get action=http://google.com/search>
<input type=hidden name=domains value=http://boinc.berkeley.edu>
<input type=hidden name=sitesearch value=http://boinc.berkeley.edu>
<nobr>
<input class=small name=q size=30>
<input type=image name=submit src=images/search.gif alt=Search>
<input class=small name=q size=20>
<input class=small type=submit value=Search>
</nobr>
</form>
";

View File

@ -30,7 +30,7 @@ function show_news_items() {
require_once("boinc_news.php");
require_once("../html/inc/news.inc");
echo "
<table border=2 cellpadding=8><tr><td bgcolor=$light_blue>
<table border=0 cellpadding=8><tr><td bgcolor=$light_blue>
<font size=4>News</font>
<br>
";
@ -65,13 +65,6 @@ function show_participate() {
".sprintf(tr(HOME_P2), "<a href=acct_mgrs.php>", "</a>", "<a href=http://gridrepublic.org>", "</a>", "<a href=http://bam.boincstats.com/>", "</a>")."
<p>
".sprintf(tr(HOME_P3), "<a href=help.php>", "</a>")."
<center>
<a href=download.php><b>".tr(HOME_DOWNLOAD)."</b></a>
| <a href=trac/wiki/RunningBoinc><b><nobr>".tr(HOME_MORE_INFO)."</nobr></b></a>
| <a href=links.php><b><nobr>".tr(HOME_WEB_SITES)."</nobr></b></a>
| <a href=addons.php><b>".tr(HOME_ADD_ONS)."</b></a>
| <a href=poll.php><b><nobr>".tr(HOME_SURVEY)."</nobr></b></a>
</center>
</td></tr>
";
}
@ -81,16 +74,17 @@ function show_create() {
echo "
<tr><td bgcolor=$light_blue><font size=4>Compute with BOINC</font></td></tr>
<tr><td>
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 <a href=trac/wiki/CreateProjectOutline>create
and operate a BOINC project</a>.
<ul>
<li> <b>Scientists</b>: 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.
<li>
Organizations such as IBM World Community Grid may be able
to host your project
(please <a href=contact.php>contact us</a> for information).
<li> <b>Universities</b>: use BOINC to create a
@ -140,6 +134,36 @@ function show_nsf() {
";
}
function language_form() {
echo "
<form name=language method=get action=set_language.php>
<select class=selectbox name=lang onchange=\"javascript: submit()\">
<option value=auto selected=\"selected\">-- language --
<option value=auto>Browser default
<option value=ar>العربية
<option value=be>Беларускі
<option value=bg>Български
<option value=ca>Català
<option value=de>Deutsch
<option value=en>English
<option value=es>Espa&ntilde;ol
<option value=fr>Fran&ccedil;ais
<option value=ja>日本語
<option value=lt>Lietuvių
<option value=pl>Polski
<option value=pt_BR>Portugu&ecirc;s - Brasil
<option value=ru>Русский
<option value=sk>Slovenčina
<option value=tr>Türkçe
<option value=zh_CN>简体中文
</select>
</form>
<script>
document.language.lang.selectedIndex=0;
</script>
";
}
html_tag();
if (defined("CHARSET")) {
header("Content-type: text/html; charset=".tr(CHARSET));
@ -162,32 +186,19 @@ echo "
".sprintf(tr(HOME_BOINC_DESC), '<a href=volunteer.php>', '</a>', '<a href=dg.php>', '</a>')."
</font>
<p>
<br clear=all>
<table width=100% border=0 cellpadding=8 cellspacing=0><tr><td valign=top>
<a href=download.php><b>".tr(HOME_DOWNLOAD)."</b></a>
| <a href=trac/wiki/RunningBoinc><b><nobr>".tr(HOME_MORE_INFO)."</nobr></b></a>
| <a href=links.php><b><nobr>".tr(HOME_WEB_SITES)."</nobr></b></a>
| <a href=addons.php><b>".tr(HOME_ADD_ONS)."</b></a>
| <a href=poll.php><b><nobr>".tr(HOME_SURVEY)."</nobr></b></a>
</td><td align=right>
";
language_form();
search_form();
echo "
<br clear=all>
<font size=-1>
<a href=set_language.php?lang=ar>العربية</a>
| <a href=set_language.php?lang=be>Беларускі</a>
| <a href=set_language.php?lang=bg>Български</a>
| <a href=set_language.php?lang=ca>Català</a>
| <a href=set_language.php?lang=de>Deutsch</a>
| <a href=set_language.php?lang=en>English</a>
| <a href=set_language.php?lang=es>Espa&ntilde;ol</a>
| <a href=set_language.php?lang=fr>Fran&ccedil;ais</a>
| <a href=set_language.php?lang=ja>日本語</a>
";
//| <a href=set_language.php?lang=ja_JP>日本語</a>
echo "
| <a href=set_language.php?lang=lt>Lietuvių</a>
| <a href=set_language.php?lang=pl>Polski</a>
| <a href=set_language.php?lang=pt_BR>Portugu&ecirc;s - Brasil</a>
| <a href=set_language.php?lang=ru>Русский</a>
| <a href=set_language.php?lang=sk>Slovenčina</a>
| <a href=set_language.php?lang=tr>Türkçe</a>
| <a href=set_language.php?lang=zh_CN>简体中文</a>
| <a href=set_language.php?lang=auto>Browser</a>
</font>
</td></tr></table>
<table width=100% border=0 cellspacing=0 cellpadding=4>
<tr>

View File

@ -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;
}
//}
?>

View File

@ -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;
}