*** empty log message ***

svn path=/trunk/boinc/; revision=3573
This commit is contained in:
Daniel Hsu 2004-06-15 00:46:59 +00:00
parent f5e970b0cb
commit 247e9702f0
10 changed files with 104 additions and 16 deletions

View File

@ -13530,3 +13530,21 @@ Rom 14 June 2004
client/
client_state.C
Daniel 14 June 2004
- client: Returning results due to "-return_results_immediately"
no longer tries to fetch work unless it's needed.
- client: Added "-check_all_logins" command-line option to force
idle checking to look at all users' terminals.
config.h.in
configure
configure.ac
client/
Makefile.in
client_state.C
client_state.h
cs_cmdline.C
cs_scheduler.C
hostinfo_unix.C

View File

@ -213,6 +213,7 @@ boinc_client_SOURCES = \
time_stats.C \
whetstone.C \
../lib/app_ipc.C \
../lib/base64.C \
../lib/crypt.C \
../lib/diagnostics.C \
../lib/exception.C \
@ -281,7 +282,8 @@ am_boinc_client_OBJECTS = boinc_client-app.$(OBJEXT) \
boinc_client-ss_logic.$(OBJEXT) \
boinc_client-time_stats.$(OBJEXT) \
boinc_client-whetstone.$(OBJEXT) boinc_client-app_ipc.$(OBJEXT) \
boinc_client-crypt.$(OBJEXT) boinc_client-diagnostics.$(OBJEXT) \
boinc_client-base64.$(OBJEXT) boinc_client-crypt.$(OBJEXT) \
boinc_client-diagnostics.$(OBJEXT) \
boinc_client-exception.$(OBJEXT) boinc_client-filesys.$(OBJEXT) \
boinc_client-language.$(OBJEXT) boinc_client-md5_file.$(OBJEXT) \
boinc_client-md5.$(OBJEXT) boinc_client-mfile.$(OBJEXT) \
@ -301,6 +303,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/boinc_client-app.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-app_ipc.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-base64.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-check_state.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-client_msgs.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-client_state.Po \
@ -430,6 +433,7 @@ boinc_client-ss_logic.$(OBJEXT): ss_logic.C
boinc_client-time_stats.$(OBJEXT): time_stats.C
boinc_client-whetstone.$(OBJEXT): whetstone.C
boinc_client-app_ipc.$(OBJEXT): ../lib/app_ipc.C
boinc_client-base64.$(OBJEXT): ../lib/base64.C
boinc_client-crypt.$(OBJEXT): ../lib/crypt.C
boinc_client-diagnostics.$(OBJEXT): ../lib/diagnostics.C
boinc_client-exception.$(OBJEXT): ../lib/exception.C
@ -457,6 +461,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-app.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-app_ipc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-base64.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-check_state.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-client_msgs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-client_state.Po@am__quote@
@ -1301,6 +1306,28 @@ boinc_client-app_ipc.obj: ../lib/app_ipc.C
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-app_ipc.obj `if test -f '../lib/app_ipc.C'; then $(CYGPATH_W) '../lib/app_ipc.C'; else $(CYGPATH_W) '$(srcdir)/../lib/app_ipc.C'`
boinc_client-base64.o: ../lib/base64.C
@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-base64.o -MD -MP -MF "$(DEPDIR)/boinc_client-base64.Tpo" \
@am__fastdepCXX_TRUE@ -c -o boinc_client-base64.o `test -f '../lib/base64.C' || echo '$(srcdir)/'`../lib/base64.C; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/boinc_client-base64.Tpo" "$(DEPDIR)/boinc_client-base64.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/boinc_client-base64.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../lib/base64.C' object='boinc_client-base64.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/boinc_client-base64.Po' tmpdepfile='$(DEPDIR)/boinc_client-base64.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-base64.o `test -f '../lib/base64.C' || echo '$(srcdir)/'`../lib/base64.C
boinc_client-base64.obj: ../lib/base64.C
@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-base64.obj -MD -MP -MF "$(DEPDIR)/boinc_client-base64.Tpo" \
@am__fastdepCXX_TRUE@ -c -o boinc_client-base64.obj `if test -f '../lib/base64.C'; then $(CYGPATH_W) '../lib/base64.C'; else $(CYGPATH_W) '$(srcdir)/../lib/base64.C'`; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/boinc_client-base64.Tpo" "$(DEPDIR)/boinc_client-base64.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/boinc_client-base64.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../lib/base64.C' object='boinc_client-base64.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/boinc_client-base64.Po' tmpdepfile='$(DEPDIR)/boinc_client-base64.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-base64.obj `if test -f '../lib/base64.C'; then $(CYGPATH_W) '../lib/base64.C'; else $(CYGPATH_W) '$(srcdir)/../lib/base64.C'`
boinc_client-crypt.o: ../lib/crypt.C
@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-crypt.o -MD -MP -MF "$(DEPDIR)/boinc_client-crypt.Tpo" \
@am__fastdepCXX_TRUE@ -c -o boinc_client-crypt.o `test -f '../lib/crypt.C' || echo '$(srcdir)/'`../lib/crypt.C; \

View File

@ -68,6 +68,7 @@ CLIENT_STATE::CLIENT_STATE() {
scheduler_op = new SCHEDULER_OP(http_ops);
client_state_dirty = false;
exit_when_idle = false;
check_all_logins = false;
return_results_immediately = false;
allow_remote_gui_rpc = false;
run_cpu_benchmarks = false;

View File

@ -93,6 +93,7 @@ public:
// same, just for network
bool started_by_screensaver;
bool exit_when_idle;
bool check_all_logins;
bool return_results_immediately;
bool allow_remote_gui_rpc;
bool show_projects;
@ -247,7 +248,7 @@ private:
bool contacted_sched_server;
void compute_resource_debts();
PROJECT* find_project_with_overdue_results();
PROJECT* find_project_with_overdue_results(bool& overdue);
void current_work_buf_days(double& work_buf, int& nactive_results);
PROJECT* next_project_sched_rpc_pending();
bool some_project_rpc_ok();

View File

@ -64,6 +64,8 @@ void CLIENT_STATE::parse_cmdline(int argc, char** argv) {
for (i=1; i<argc; i++) {
if (ARG(exit_when_idle)) {
exit_when_idle = true;
} else if (ARG(check_all_logins)) {
check_all_logins = true;
} else if (ARG(return_results_immediately)) {
return_results_immediately = true;
} else if (ARG(skip_cpu_benchmarks)) {

View File

@ -362,7 +362,7 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p, double work_req) {
// find a project with results that are overdue to report,
// and which we're allowed to contact.
//
PROJECT* CLIENT_STATE::find_project_with_overdue_results() {
PROJECT* CLIENT_STATE::find_project_with_overdue_results(bool& overdue) {
unsigned int i;
float fReportDeadlineToReport = 0.0;
RESULT* r;
@ -392,9 +392,12 @@ PROJECT* CLIENT_STATE::find_project_with_overdue_results() {
// ignore the report deadline when deciding when to report a result
//
if (r->ready_to_report &&
(return_results_immediately ||
r->report_deadline <= (now + fReportDeadlineToReport)))
r->report_deadline <= (now + fReportDeadlineToReport))
{
overdue = true;
return r->project;
} else if (r->ready_to_report && return_results_immediately) {
overdue = false;
return r->project;
}
}
@ -429,13 +432,13 @@ bool CLIENT_STATE::scheduler_rpc_poll() {
if (exit_when_idle && contacted_sched_server) {
should_get_work = false;
} else {
// TODO: the following is a kludge to prevent
// repeated work requests, but it defeats the
// work_buf_min concept
//
// TODO: the following is a kludge to prevent
// repeated work requests, but it defeats the
// work_buf_min concept
//
//below_work_buf_min = (current_work_buf_days() <= global_prefs.work_buf_min_days);
current_work_buf_days(work_buf_days, nactive_results);
below_work_buf_min = nactive_results < host_info.p_ncpus;
current_work_buf_days(work_buf_days, nactive_results);
below_work_buf_min = nactive_results < host_info.p_ncpus;
should_get_work = below_work_buf_min && some_project_rpc_ok();
}
if (should_get_work) {
@ -450,10 +453,11 @@ bool CLIENT_STATE::scheduler_rpc_poll() {
scheduler_op->init_return_results(p, 0);
action = true;
} else {
p = find_project_with_overdue_results();
bool overdue = false;
p = find_project_with_overdue_results(overdue);
if (p) {
compute_resource_debts();
if (p->debt_order == 0) {
if (overdue && p->debt_order == 0) {
work_secs = work_needed_secs();
} else {
work_secs = 0;

View File

@ -55,6 +55,9 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_UTMP_H
#include <utmp.h>
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
@ -420,11 +423,38 @@ inline bool all_tty_idle(time_t t, char *device, char first_char, int num_tty) {
return true;
}
inline bool user_idle(time_t t, struct utmp* u) {
char tty[5 + sizeof u->ut_line + 1] = "/dev/";
unsigned int i;
for (i=0; i < sizeof(u->ut_line); i++) /* clean up tty if garbled */
if (isalnum((int) u->ut_line[i]) || (u->ut_line[i]=='/'))
tty[i+5] = u->ut_line[i];
else
tty[i+5] = '\0';
return device_idle(t, tty);
}
inline bool all_logins_idle(time_t t) {
struct utmp* u;
setutent();
while ((u = getutent()) != NULL) {
if (!user_idle(t, u)) {
return false;
}
}
return true;
}
void CLIENT_STATE::check_idle() {
#ifdef HAVE__DEV_TTY1
char device_tty[] = "/dev/tty1";
#endif
time_t idle_time =
time(NULL) - (long) (60 * global_prefs.idle_time_to_run);
user_idle = true
&& (!check_all_logins || all_logins_idle(idle_time))
#ifdef HAVE__DEV_MOUSE
&& device_idle(idle_time, "/dev/mouse") // solaris, linux
#endif
@ -432,7 +462,8 @@ void CLIENT_STATE::check_idle() {
&& device_idle(idle_time, "/dev/kbd") // solaris
#endif
#ifdef HAVE__DEV_TTY1
&& all_tty_idle(idle_time, device_tty, '1', 7) // linux
&& (check_all_logins || all_tty_idle(idle_time, device_tty, '1', 7))
#endif
;
}

View File

@ -265,6 +265,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <utmp.h> header file. */
#undef HAVE_UTMP_H
/* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF

3
configure vendored
View File

@ -6047,7 +6047,8 @@ done
for ac_header in arpa/inet.h dirent.h fcntl.h malloc.h netdb.h netinet/in.h netinet/tcp.h signal.h strings.h sys/file.h sys/ipc.h sys/mount.h sys/resource.h sys/select.h sys/shm.h sys/socket.h sys/statvfs.h sys/statfs.h sys/swap.h sys/sysctl.h sys/systeminfo.h sys/time.h sys/types.h sys/utsname.h sys/vmmeter.h sys/wait.h unistd.h errno.h
for ac_header in arpa/inet.h dirent.h fcntl.h malloc.h netdb.h netinet/in.h netinet/tcp.h signal.h strings.h sys/file.h sys/ipc.h sys/mount.h sys/resource.h sys/select.h sys/shm.h sys/socket.h sys/statvfs.h sys/statfs.h sys/swap.h sys/sysctl.h sys/systeminfo.h sys/time.h sys/types.h sys/utsname.h sys/vmmeter.h sys/wait.h unistd.h utmp.h errno.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then

View File

@ -86,7 +86,7 @@ AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_TYPE_SIGNAL
AC_CHECK_HEADERS(arpa/inet.h dirent.h fcntl.h malloc.h netdb.h netinet/in.h netinet/tcp.h signal.h strings.h sys/file.h sys/ipc.h sys/mount.h sys/resource.h sys/select.h sys/shm.h sys/socket.h sys/statvfs.h sys/statfs.h sys/swap.h sys/sysctl.h sys/systeminfo.h sys/time.h sys/types.h sys/utsname.h sys/vmmeter.h sys/wait.h unistd.h errno.h)
AC_CHECK_HEADERS(arpa/inet.h dirent.h fcntl.h malloc.h netdb.h netinet/in.h netinet/tcp.h signal.h strings.h sys/file.h sys/ipc.h sys/mount.h sys/resource.h sys/select.h sys/shm.h sys/socket.h sys/statvfs.h sys/statfs.h sys/swap.h sys/sysctl.h sys/systeminfo.h sys/time.h sys/types.h sys/utsname.h sys/vmmeter.h sys/wait.h unistd.h utmp.h errno.h)
SAH_GRX_INCLUDES
AC_LANG_PUSH(C++)
SAH_HEADER_STDCXX