diff --git a/checkin_notes b/checkin_notes
index 2994a90ac6..2e99fa14c7 100755
--- a/checkin_notes
+++ b/checkin_notes
@@ -6725,3 +6725,21 @@ David 23 June 2006
client/
app-control.C
log_flags.h
+
+David 23 June 2006
+ - core client:
+ - fix bug in printing argv on task startup (Unix)
+ - changed message: "misses deadline" -> "projected to miss deadline"
+ - parse version in scheduler reply, and show it if log_flags.sched_ops
+ - cpu_usage_limit must be in (0..1]
+
+ client/
+ app_start.C
+ cpu_sched.C
+ cs_apps.C
+ cs_prefs.C
+ cs_scheduler.C
+ scheduler_op.C,h
+ lib/
+ prefs.C
+ util.C
diff --git a/client/app_start.C b/client/app_start.C
index ee9af76f06..5211ac9eff 100644
--- a/client/app_start.C
+++ b/client/app_start.C
@@ -606,9 +606,6 @@ int ACTIVE_TASK::start(bool first_time) {
#endif
char cmdline[8192];
strcpy(cmdline, wup->command_line.c_str());
- if (log_flags.task_debug) {
- debug_print_argv(argv);
- }
sprintf(buf, "../../%s", exec_path );
#ifdef SANDBOX
char switcher_path[100];
@@ -617,6 +614,9 @@ int ACTIVE_TASK::start(bool first_time) {
argv[1] = buf;
argv[2] = exec_name;
parse_command_line(cmdline, argv+3);
+ if (log_flags.task_debug) {
+ debug_print_argv(argv);
+ }
retval = execv(switcher_path, argv);
#else
argv[0] = exec_name;
diff --git a/client/cpu_sched.C b/client/cpu_sched.C
index 3e84fd78c1..efa04d2e6e 100644
--- a/client/cpu_sched.C
+++ b/client/cpu_sched.C
@@ -362,12 +362,12 @@ void CLIENT_STATE::print_deadline_misses() {
rp = results[i];
if (rp->rr_sim_misses_deadline && !rp->last_rr_sim_missed_deadline) {
msg_printf(rp->project, MSG_INFO,
- "Result %s now misses deadline.", rp->name
+ "Result %s projected to miss deadline.", rp->name
);
}
else if (!rp->rr_sim_misses_deadline && rp->last_rr_sim_missed_deadline) {
msg_printf(rp->project, MSG_INFO,
- "Result %s now meets deadline.", rp->name
+ "Result %s projected to meet deadline.", rp->name
);
}
}
@@ -375,7 +375,7 @@ void CLIENT_STATE::print_deadline_misses() {
p = projects[i];
if (p->rr_sim_deadlines_missed) {
msg_printf(p, MSG_INFO,
- "Project has %d deadline misses",
+ "Project has %d projected deadline misses",
p->rr_sim_deadlines_missed
);
}
@@ -457,7 +457,7 @@ void CLIENT_STATE::schedule_cpus() {
ordered_scheduled_results.push_back(rp);
}
- request_enforce_schedule("");
+ request_enforce_schedule("schedule_cpus");
set_client_state_dirty("schedule_cpus");
}
diff --git a/client/cs_apps.C b/client/cs_apps.C
index 09e73cc624..a9410ce1cd 100644
--- a/client/cs_apps.C
+++ b/client/cs_apps.C
@@ -374,25 +374,25 @@ int CLIENT_STATE::choose_version_num(char* app_name, SCHEDULER_REPLY& sr) {
return best;
}
+// trigger CPU schedule enforcement.
+// Called when a new schedule is computed,
+// and when an app checkpoints.
+//
void CLIENT_STATE::request_enforce_schedule(const char* where) {
- // The CPU scheduler runs when a result is completed,
- // when the end of the user-specified scheduling period is reached,
- // when new results become runnable,
- // or when the user performs a UI interaction (e.g. suspending or resuming a project or result).
- //
- if (log_flags.cpu_sched_debug && where && strlen(where)) {
+ if (log_flags.cpu_sched_debug) {
msg_printf(0, MSG_INFO, "Request enforce CPU schedule: %s", where);
}
must_enforce_cpu_schedule = true;
}
+// trigger CPU scheduling.
+// Called when a result is completed,
+// when new results become runnable,
+// or when the user performs a UI interaction
+// (e.g. suspending or resuming a project or result).
+//
void CLIENT_STATE::request_schedule_cpus(const char* where) {
- // The CPU scheduler runs when a result is completed,
- // when the end of the user-specified scheduling period is reached,
- // when new results become runnable,
- // or when the user performs a UI interaction (e.g. suspending or resuming a project or result).
- //
- if (log_flags.cpu_sched_debug && where && strlen(where)) {
+ if (log_flags.cpu_sched_debug) {
msg_printf(0, MSG_INFO, "Request CPU reschedule: %s", where);
}
must_schedule_cpus = true;
diff --git a/client/cs_prefs.C b/client/cs_prefs.C
index e8eac23a92..36bd1bed8d 100644
--- a/client/cs_prefs.C
+++ b/client/cs_prefs.C
@@ -207,6 +207,11 @@ static string reason_string(int reason) {
int CLIENT_STATE::suspend_tasks(int reason) {
if (reason == SUSPEND_REASON_CPU_USAGE_LIMIT) {
+ if (log_flags.cpu_sched) {
+ string s_reason;
+ s_reason = "Suspending computation" + reason_string(reason);
+ msg_printf(NULL, MSG_INFO, s_reason.c_str());
+ }
active_tasks.suspend_all(true);
} else {
string s_reason;
diff --git a/client/cs_scheduler.C b/client/cs_scheduler.C
index c1af573073..073b6cf852 100644
--- a/client/cs_scheduler.C
+++ b/client/cs_scheduler.C
@@ -758,6 +758,12 @@ int CLIENT_STATE::handle_scheduler_reply(
fclose(f);
if (retval) return retval;
+ if (log_flags.sched_ops) {
+ msg_printf(project, MSG_INFO,
+ "Scheduler version: %d", sr.scheduler_version
+ );
+ }
+
// check that master URL is correct
//
if (strlen(sr.master_url)) {
diff --git a/client/scheduler_op.C b/client/scheduler_op.C
index bca2efd3c4..7721d26689 100644
--- a/client/scheduler_op.C
+++ b/client/scheduler_op.C
@@ -829,6 +829,8 @@ int SCHEDULER_REPLY::parse(FILE* in, PROJECT* project) {
continue;
} else if (match_tag(buf, "")) {
send_file_list = true;
+ } else if (parse_int(buf, "", scheduler_version)) {
+ continue;
} else if (strlen(buf)>1){
if (log_flags.unparsed_xml) {
msg_printf(0, MSG_ERROR,
diff --git a/client/scheduler_op.h b/client/scheduler_op.h
index 8295dd27db..40aeb4ec23 100644
--- a/client/scheduler_op.h
+++ b/client/scheduler_op.h
@@ -128,6 +128,7 @@ struct SCHEDULER_REPLY {
bool message_ack;
bool project_is_down;
bool send_file_list;
+ int scheduler_version;
SCHEDULER_REPLY();
~SCHEDULER_REPLY();
diff --git a/lib/prefs.C b/lib/prefs.C
index 8ee15a66c3..a3af60ffa2 100644
--- a/lib/prefs.C
+++ b/lib/prefs.C
@@ -114,6 +114,7 @@ int GLOBAL_PREFS::parse_override(
) {
char buf[256], buf2[256];
bool in_venue = false, in_correct_venue=false;
+ double dtemp;
found_venue = false;
while (in.fgets(buf, 256)) {
@@ -210,7 +211,10 @@ int GLOBAL_PREFS::parse_override(
#endif
} else if (parse_int(buf, "", cpu_affinity)) {
continue;
- } else if (parse_double(buf, "", cpu_usage_limit)) {
+ } else if (parse_double(buf, "", dtemp)) {
+ if (dtemp > 0 && dtemp <= 1) {
+ cpu_usage_limit = dtemp;
+ }
continue;
}
}
diff --git a/lib/util.C b/lib/util.C
index b4a9cd61d4..c8b49e3b67 100755
--- a/lib/util.C
+++ b/lib/util.C
@@ -823,8 +823,10 @@ int boinc_calling_thread_cpu_time(double &cpu_t) {
struct rusage ru;
// getrusage can return an error, so try a few times if it returns an error.
if (!pthread_mutex_trylock(&getrusage_mutex)) {
- int i=0;
- while (retval=getrusage(RUSAGE_SELF, &ru) && i<10) i++;
+ for (int i=0; i<10; i++) {
+ retval=getrusage(RUSAGE_SELF, &ru);
+ if (!retval) break;
+ }
pthread_mutex_unlock(&getrusage_mutex);
}
if (retval) {