- client: add --no_priority_change cmdline arg

(and <no_priority_change> flag in cc_config.xml).
    If set, run apps at same priority as client.

svn path=/trunk/boinc/; revision=17639
This commit is contained in:
David Anderson 2009-03-20 18:56:54 +00:00
parent 30baaf0783
commit d152b52817
5 changed files with 36 additions and 9 deletions

View File

@ -3177,3 +3177,13 @@ David 20 Mar 2009
cpu_sched.cpp
cs_statefile.cpp
log_flags.cpp,h
David 20 Mar 2009
- client: add --no_priority_change cmdline arg
(and <no_priority_change> flag in cc_config.xml).
If set, run apps at same priority as client.
client/
app_start.cpp
cs_cmdline.cpp
log_flags.cpp,h

View File

@ -580,7 +580,14 @@ int ACTIVE_TASK::start(bool first_time) {
relative_to_absolute(slot_dir, slotdirpath);
bool success = false;
int prio_mask = high_priority?BELOW_NORMAL_PRIORITY_CLASS:IDLE_PRIORITY_CLASS;
int prio_mask;
if (config.no_priority_change) {
prio_mask = 0;
} else if (high_priority) {
prio_mask = BELOW_NORMAL_PRIORITY_CLASS;
} else {
prio_mask = IDLE_PRIORITY_CLASS;
}
for (i=0; i<5; i++) {
if (sandbox_account_service_token != NULL) {
@ -736,10 +743,12 @@ int ACTIVE_TASK::start(bool first_time) {
);
}
if (setpriority(PRIO_PROCESS, pid,
high_priority?PROCESS_MEDIUM_PRIORITY:PROCESS_IDLE_PRIORITY)
) {
perror("setpriority");
if (!config.no_priority_change) {
if (setpriority(PRIO_PROCESS, pid,
high_priority?PROCESS_MEDIUM_PRIORITY:PROCESS_IDLE_PRIORITY)
) {
perror("setpriority");
}
}
#else
@ -861,10 +870,12 @@ int ACTIVE_TASK::start(bool first_time) {
freopen(STDERR_FILE, "a", stderr);
#ifdef HAVE_SETPRIORITY
if (setpriority(PRIO_PROCESS, 0,
high_priority?PROCESS_MEDIUM_PRIORITY:PROCESS_IDLE_PRIORITY)
) {
perror("setpriority");
if (!config.no_priority_change) {
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

@ -64,6 +64,7 @@ static void print_options(char* prog) {
" --master_fetch_period N reload master URL after N RPC failures\n"
" --master_fetch_retry_cap N exponential backoff limit\n"
" --no_gui_rpc don't allow GUI RPC, don't make socket\n"
" --no_priority_change run apps at same priority as client\n"
" --pers_giveup N giveup time for persistent file xfer\n"
" --pers_retry_delay_max N max for file xfer exponential backoff\n"
" --pers_retry_delay_min N min for file xfer exponential backoff\n"
@ -173,6 +174,8 @@ void CLIENT_STATE::parse_cmdline(int argc, char** argv) {
else master_fetch_retry_cap = atoi(argv[++i]);
} else if (ARG(no_gui_rpc)) {
no_gui_rpc = true;
} else if (ARG(no_priority_change)) {
config.no_priority_change = true;
} else if (ARG(pers_giveup)) {
if (i == argc-1) show_options = true;
else pers_giveup = atoi(argv[++i]);

View File

@ -193,6 +193,7 @@ void CONFIG::defaults() {
network_test_url = "http://www.google.com/";
no_gpus = false;
zero_debts = false;
no_priority_change = false;
}
int CONFIG::parse_options(XML_PARSER& xp) {
@ -263,6 +264,7 @@ int CONFIG::parse_options(XML_PARSER& xp) {
}
if (xp.parse_bool(tag, "no_gpus", no_gpus)) continue;
if (xp.parse_bool(tag, "zero_debts", zero_debts)) continue;
if (xp.parse_bool(tag, "no_priority_change", no_priority_change)) continue;
if (xp.parse_bool(tag, "abort_jobs_on_exit", btemp)) {
gstate.abort_jobs_on_exit = true;
continue;

View File

@ -133,6 +133,7 @@ struct CONFIG {
std::string network_test_url;
bool no_gpus;
bool zero_debts;
bool no_priority_change;
CONFIG();
void defaults();