From f6b68e706868e90e615d83f0825d8d20e70e5366 Mon Sep 17 00:00:00 2001 From: Bruce Allen Date: Sun, 25 Feb 2007 05:29:31 +0000 Subject: [PATCH] - scheduler: stop logging error messages about unrecognized tag. - locality scheduler: when getting a working set file name using glob(3), do not glob multiple times, possibly getting back the same file name again. Instead glob once and then randomly choose file names, crossing items off the list one at a time. Note: I wrote this code using STL vectors and strings, but now regret this: the necessary vector insertions are potentially inefficient.. Sometime next week I will recode this using a C-style pointer arrays with guaranteed O(1) efficiency. But I want to get this into CVS while it's working. - locality scheduler: fix is_host_slow() function following David's Jan 12 checkins to use claimed_credit_per_cpu_sec. svn path=/trunk/boinc/; revision=12156 --- checkin_notes | 21 ++++++ sched/sched_config.C | 1 + sched/sched_locality.C | 150 +++++++++++++++++++++++++++++++---------- 3 files changed, 136 insertions(+), 36 deletions(-) diff --git a/checkin_notes b/checkin_notes index ebd980a4c4..002f855a21 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2020,3 +2020,24 @@ David 24 Feb 2007 client/ client_state.C + +Bruce 25 Feb 2007 + - scheduler: stop logging error messages about unrecognized + tag. + - locality scheduler: when getting a working set file name + using glob(3), do not glob multiple times, possibly getting + back the same file name again. Instead glob once and then + randomly choose file names, crossing items off the list one + at a time. Note: I wrote this code using STL vectors and + strings, but now regret this: the necessary vector insertions + are potentially inefficient.. Sometime next week I will + recode this using a C-style pointer arrays with guaranteed O(1) + efficiency. But I want to get this into CVS while it's + working. + - locality scheduler: fix is_host_slow() function following + David's Jan 12 checkins to use claimed_credit_per_cpu_sec. + + sched/ + sched_config.C + sched_locality.C + diff --git a/sched/sched_config.C b/sched/sched_config.C index b73878a8a8..445dffb266 100644 --- a/sched/sched_config.C +++ b/sched/sched_config.C @@ -133,6 +133,7 @@ int SCHED_CONFIG::parse(FILE* f) { else if (xp.parse_str(tag, "profile_screening", temp, sizeof(temp))) continue; else if (xp.parse_str(tag, "min_passwd_length", temp, sizeof(temp))) continue; else if (xp.parse_str(tag, "disable_account_creation", temp, sizeof(temp))) continue; + else if (xp.parse_str(tag, "no_forum_rating", temp, sizeof(temp))) continue; else fprintf(stderr, "unknown tag: %s\n", tag); } return ERR_XML_PARSE; diff --git a/sched/sched_locality.C b/sched/sched_locality.C index b44a28e83c..dbb0cfd34b 100644 --- a/sched/sched_locality.C +++ b/sched/sched_locality.C @@ -39,6 +39,11 @@ #include "sched_locality.h" #include "sched_util.h" +#include +#include +#include +using namespace std; + #define VERBOSE_DEBUG // returns zero if there is a file we can delete. @@ -364,56 +369,117 @@ int make_more_work_for_file(char* filename) { // Get a randomly-chosen filename in the working set. // -static int get_working_set_filename(char *filename, bool slowhost) { +// We store a static list to prevent duplicate filename returns +// and to cut down on invocations of glob +// +// + +std::vector filenamelist; +int list_type = 0; // 0: none, 1: slowhost, 2: fasthost + +static void build_working_set_namelist(bool slowhost) { glob_t globbuf; - int retglob, random_file; - char *last_slash; + int retglob; + unsigned int i; const char *pattern = "../locality_scheduling/work_available/*"; + const char *errtype = "unrecognized error"; + const char *hosttype = "fasthost"; #ifdef EINSTEIN_AT_HOME - if (slowhost) pattern = "../locality_scheduling/work_available/*_0[0-3]*"; + if (slowhost) { + hosttype = "slowhost"; + pattern = "../locality_scheduling/work_available/*_0[0-3]*"; + } #endif retglob=glob(pattern, GLOB_ERR|GLOB_NOSORT|GLOB_NOCHECK, NULL, &globbuf); if (retglob || !globbuf.gl_pathc) { - // directory did not exist or is not readable - goto error_exit; + errtype = "no directory or not readable"; + } else { + if (globbuf.gl_pathc==1 && !strcmp(pattern, globbuf.gl_pathv[0])) { + errtype = "empty directory"; + } else { + for (i=0; i