- client (Unix): if app uses < 1 CPU, run at nice 10 (not 0)

- client: suppress specious error message

svn path=/trunk/boinc/; revision=16496
This commit is contained in:
David Anderson 2008-11-14 22:08:50 +00:00
parent 553f708f6c
commit 98d6931d63
4 changed files with 438 additions and 422 deletions

View File

@ -9438,3 +9438,13 @@ Rom 10 Nov 2008
/
configure.ac
version.h
David 14 Nov 2008
- client (Unix): if app uses < 1 CPU, run at nice 10 (not 0)
- client: suppress specious error message
client/
app_start.cpp
rr_sim.cpp
lib/
util.h

View File

@ -687,10 +687,10 @@ int ACTIVE_TASK::start(bool first_time) {
);
}
if (!high_priority) {
if (setpriority(PRIO_PROCESS, pid, PROCESS_IDLE_PRIORITY)) {
perror("setpriority");
}
if (setpriority(PRIO_PROCESS, pid,
high_priority?PROCESS_MEDIUM_PRIORITY:PROCESS_IDLE_PRIORITY)
) {
perror("setpriority");
}
#else
@ -812,10 +812,10 @@ int ACTIVE_TASK::start(bool first_time) {
freopen(STDERR_FILE, "a", stderr);
#ifdef HAVE_SETPRIORITY
if (!high_priority) {
if (setpriority(PRIO_PROCESS, 0, PROCESS_IDLE_PRIORITY)) {
perror("setpriority");
}
if (setpriority(PRIO_PROCESS, 0,
high_priority?PROCESS_MEDIUM_PRIORITY:PROCESS_IDLE_PRIORITY)
) {
perror("setpriority");
}
#endif
sprintf(cmdline, "%s %s", wup->command_line.c_str(), app_version->cmdline);

View File

@ -55,10 +55,15 @@ struct RR_SIM_STATUS {
it = active.erase(it);
} else {
rp->rrsim_cpu_left -= rp->rrsim_rate*rpbest->rrsim_finish_delay;
if (rp->rrsim_cpu_left < 0) {
// can be slightly less than 0 due to roundoff
//
if (rp->rrsim_cpu_left < -1) {
msg_printf(rp->project, MSG_INTERNAL_ERROR,
"%s: negative CPU time left %f", rp->name, rp->rrsim_cpu_left
);
}
if (rp->rrsim_cpu_left < 0) {
rp->rrsim_cpu_left = 0;
}
it++;

View File

@ -58,6 +58,7 @@ extern int boinc_process_cpu_time(double& cpu);
// (don't use 20 because
//
static const int PROCESS_IDLE_PRIORITY = 19;
static const int PROCESS_MEDIUM_PRIORITY = 10;
extern double linux_cpu_time(int pid);
#endif