mirror of https://github.com/BOINC/boinc.git
client and manager: when parsing NIU prefs, immediately chanee 0 to 100.
This eliminates ambiguity between "no limit" and "inherit from in use"
This commit is contained in:
parent
e5367f8a96
commit
28e9114fba
|
@ -711,21 +711,19 @@ void CLIENT_STATE::print_global_prefs() {
|
||||||
// not in use
|
// not in use
|
||||||
//
|
//
|
||||||
msg_printf(NULL, MSG_INFO,
|
msg_printf(NULL, MSG_INFO,
|
||||||
"- When computer is not in use (defaults: same as in use)"
|
"- When computer is not in use"
|
||||||
);
|
);
|
||||||
p = global_prefs.niu_max_ncpus_pct;
|
p = global_prefs.niu_max_ncpus_pct;
|
||||||
if (p) {
|
int n = (int)((host_info.p_ncpus * p)/100);
|
||||||
int n = (int)((host_info.p_ncpus * p)/100);
|
msg_printf(NULL, MSG_INFO,
|
||||||
msg_printf(NULL, MSG_INFO,
|
"- max CPUs used: %d", n
|
||||||
"- max CPUs used: %d", n
|
);
|
||||||
);
|
|
||||||
}
|
msg_printf(NULL, MSG_INFO,
|
||||||
if (global_prefs.niu_cpu_usage_limit) {
|
"- Use at most %.0f%% of the CPU time",
|
||||||
msg_printf(NULL, MSG_INFO,
|
global_prefs.niu_cpu_usage_limit
|
||||||
"- Use at most %.0f%% of the CPU time",
|
);
|
||||||
global_prefs.niu_cpu_usage_limit
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (global_prefs.niu_suspend_cpu_usage > 0) {
|
if (global_prefs.niu_suspend_cpu_usage > 0) {
|
||||||
msg_printf(NULL, MSG_INFO,
|
msg_printf(NULL, MSG_INFO,
|
||||||
"- suspend if non-BOINC CPU load exceeds %.0f%%",
|
"- suspend if non-BOINC CPU load exceeds %.0f%%",
|
||||||
|
|
|
@ -327,12 +327,14 @@ void CDlgAdvPreferences::ReadPreferenceSettings() {
|
||||||
// 0 means "no restriction" but we don't use a checkbox here
|
// 0 means "no restriction" but we don't use a checkbox here
|
||||||
if (prefs.max_ncpus_pct == 0.0) prefs.max_ncpus_pct = 100.0;
|
if (prefs.max_ncpus_pct == 0.0) prefs.max_ncpus_pct = 100.0;
|
||||||
DisplayValue(prefs.max_ncpus_pct, m_txtProcUseProcessors);
|
DisplayValue(prefs.max_ncpus_pct, m_txtProcUseProcessors);
|
||||||
|
if (prefs.niu_max_ncpus_pct == 0.0) prefs.niu_max_ncpus_pct = 100.0;
|
||||||
DisplayValue(prefs.niu_max_ncpus_pct, m_txtProcUseProcessorsNotInUse);
|
DisplayValue(prefs.niu_max_ncpus_pct, m_txtProcUseProcessorsNotInUse);
|
||||||
|
|
||||||
// cpu limit
|
// cpu limit
|
||||||
// 0 means "no restriction" but we don't use a checkbox here
|
// 0 means "no restriction" but we don't use a checkbox here
|
||||||
if (prefs.cpu_usage_limit == 0.0) prefs.cpu_usage_limit = 100.0;
|
if (prefs.cpu_usage_limit == 0.0) prefs.cpu_usage_limit = 100.0;
|
||||||
DisplayValue(prefs.cpu_usage_limit, m_txtProcUseCPUTime);
|
DisplayValue(prefs.cpu_usage_limit, m_txtProcUseCPUTime);
|
||||||
|
if (prefs.niu_cpu_usage_limit == 0.0) prefs.niu_cpu_usage_limit = 100.0;
|
||||||
DisplayValue(prefs.niu_cpu_usage_limit, m_txtProcUseCPUTimeNotInUse);
|
DisplayValue(prefs.niu_cpu_usage_limit, m_txtProcUseCPUTimeNotInUse);
|
||||||
|
|
||||||
// on batteries
|
// on batteries
|
||||||
|
|
|
@ -537,7 +537,7 @@ int GLOBAL_PREFS::parse_override(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (xp.parse_double("niu_max_ncpus_pct", niu_max_ncpus_pct)) {
|
if (xp.parse_double("niu_max_ncpus_pct", niu_max_ncpus_pct)) {
|
||||||
if (niu_max_ncpus_pct < 0) niu_max_ncpus_pct = 0;
|
if (niu_max_ncpus_pct <= 0) niu_max_ncpus_pct = 100;
|
||||||
if (niu_max_ncpus_pct > 100) niu_max_ncpus_pct = 100;
|
if (niu_max_ncpus_pct > 100) niu_max_ncpus_pct = 100;
|
||||||
mask.niu_max_ncpus_pct = true;
|
mask.niu_max_ncpus_pct = true;
|
||||||
continue;
|
continue;
|
||||||
|
@ -604,10 +604,10 @@ int GLOBAL_PREFS::parse_override(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (xp.parse_double("niu_cpu_usage_limit", dtemp)) {
|
if (xp.parse_double("niu_cpu_usage_limit", dtemp)) {
|
||||||
if (dtemp > 0 && dtemp <= 100) {
|
if (dtemp <= 0) dtemp = 100;
|
||||||
niu_cpu_usage_limit = dtemp;
|
if (dtemp > 100) dtemp = 100;
|
||||||
mask.niu_cpu_usage_limit = true;
|
niu_cpu_usage_limit = dtemp;
|
||||||
}
|
mask.niu_cpu_usage_limit = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (xp.parse_double("daily_xfer_limit_mb", dtemp)) {
|
if (xp.parse_double("daily_xfer_limit_mb", dtemp)) {
|
||||||
|
|
Loading…
Reference in New Issue