mirror of https://github.com/BOINC/boinc.git
- fix longstanding bug in CPU throttling
svn path=/trunk/boinc/; revision=14530
This commit is contained in:
parent
132f7cdb48
commit
869691f3a3
|
@ -308,3 +308,9 @@ Charlie Jan 10 2008
|
|||
boinc.xcodeproj/
|
||||
project.pbxproj
|
||||
BuildMacBOINC.sh
|
||||
|
||||
David Jan 10 2008
|
||||
- Fix long-standing bug in CPU throttling
|
||||
|
||||
client/
|
||||
cs_prefs.C
|
||||
|
|
|
@ -146,18 +146,16 @@ int CLIENT_STATE::check_suspend_processing() {
|
|||
|
||||
if (global_prefs.cpu_usage_limit != 100) {
|
||||
static double last_time=0, debt=0;
|
||||
if (last_time) {
|
||||
double diff = now - last_time;
|
||||
if (diff >= POLL_INTERVAL/2. && diff < POLL_INTERVAL*10.) {
|
||||
debt += diff*global_prefs.cpu_usage_limit/100;
|
||||
if (debt < 0) {
|
||||
return SUSPEND_REASON_CPU_USAGE_LIMIT;
|
||||
} else {
|
||||
debt -= diff;
|
||||
}
|
||||
double diff = now - last_time;
|
||||
last_time = now;
|
||||
if (diff >= POLL_INTERVAL/2. && diff < POLL_INTERVAL*10.) {
|
||||
debt += diff*global_prefs.cpu_usage_limit/100;
|
||||
if (debt < 0) {
|
||||
return SUSPEND_REASON_CPU_USAGE_LIMIT;
|
||||
} else {
|
||||
debt -= diff;
|
||||
}
|
||||
}
|
||||
last_time = now;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue