mirror of https://github.com/BOINC/boinc.git
android: re-enable cpu throttling with bug fixes.
This commit is contained in:
parent
d1ef167b8d
commit
cebe16ccbe
|
@ -204,7 +204,7 @@ public class PrefsActivity extends FragmentActivity {
|
|||
// cpu
|
||||
if(advanced) data.add(new PrefsListItemWrapper(this,R.string.prefs_category_cpu,true));
|
||||
if(advanced && hostinfo.p_ncpus > 1) data.add(new PrefsListItemWrapperValue(this,R.string.prefs_cpu_number_cpus_header,R.string.prefs_category_cpu,pctCpuCoresToNumber(clientPrefs.max_ncpus_pct)));
|
||||
//if(advanced) data.add(new PrefsListItemWrapperValue(this,R.string.prefs_cpu_time_max_header,R.string.prefs_category_cpu,clientPrefs.cpu_usage_limit));
|
||||
if(advanced) data.add(new PrefsListItemWrapperValue(this,R.string.prefs_cpu_time_max_header,R.string.prefs_category_cpu,clientPrefs.cpu_usage_limit));
|
||||
if(advanced) data.add(new PrefsListItemWrapperValue(this,R.string.prefs_cpu_other_load_suspension_header,R.string.prefs_category_cpu,clientPrefs.suspend_cpu_usage));
|
||||
// storage
|
||||
if(advanced) data.add(new PrefsListItemWrapper(this,R.string.prefs_category_storage,true));
|
||||
|
@ -482,10 +482,9 @@ public class PrefsActivity extends FragmentActivity {
|
|||
//convert value back to number for layout update
|
||||
value = pctCpuCoresToNumber(value);
|
||||
break;
|
||||
/*
|
||||
case R.string.prefs_cpu_time_max_header:
|
||||
clientPrefs.cpu_usage_limit = value;
|
||||
break;*/
|
||||
break;
|
||||
case R.string.prefs_cpu_other_load_suspension_header:
|
||||
clientPrefs.suspend_cpu_usage = value;
|
||||
break;
|
||||
|
|
|
@ -458,21 +458,15 @@ public class ClientStatus {
|
|||
computingParseError = false;
|
||||
return;
|
||||
}
|
||||
if(status.task_mode == BOINCDefs.RUN_MODE_AUTO && status.task_suspend_reason == BOINCDefs.SUSPEND_REASON_CPU_THROTTLE) {
|
||||
// suspended due to CPU throttling, treat as if was running!
|
||||
computingStatus = COMPUTING_STATUS_COMPUTING;
|
||||
computingSuspendReason = status.task_suspend_reason; // = 64 - SUSPEND_REASON_CPU_THROTTLE
|
||||
computingParseError = false;
|
||||
return;
|
||||
|
||||
}
|
||||
if((status.task_mode == BOINCDefs.RUN_MODE_AUTO) && (status.task_suspend_reason != BOINCDefs.SUSPEND_NOT_SUSPENDED)) {
|
||||
if((status.task_mode == BOINCDefs.RUN_MODE_AUTO) && (status.task_suspend_reason != BOINCDefs.SUSPEND_NOT_SUSPENDED) && (status.task_suspend_reason != BOINCDefs.SUSPEND_REASON_CPU_THROTTLE)) {
|
||||
// do not expose cpu throttling as suspension to UI
|
||||
computingStatus = COMPUTING_STATUS_SUSPENDED;
|
||||
computingSuspendReason = status.task_suspend_reason;
|
||||
computingParseError = false;
|
||||
return;
|
||||
}
|
||||
if((status.task_mode == BOINCDefs.RUN_MODE_AUTO) && (status.task_suspend_reason == BOINCDefs.SUSPEND_NOT_SUSPENDED)) {
|
||||
if((status.task_mode == BOINCDefs.RUN_MODE_AUTO) && ((status.task_suspend_reason == BOINCDefs.SUSPEND_NOT_SUSPENDED) || (status.task_suspend_reason == BOINCDefs.SUSPEND_REASON_CPU_THROTTLE))) {
|
||||
// treat cpu throttling as if client was active (either idle, or computing, depending on tasks)
|
||||
//figure out whether we have an active task
|
||||
Boolean activeTask = false;
|
||||
if(results!=null) {
|
||||
|
|
|
@ -191,21 +191,7 @@ public class Monitor extends Service {
|
|||
rpc.readGlobalPrefsOverride();
|
||||
// read preferences for GUI to be able to display data
|
||||
GlobalPreferences clientPrefs = rpc.getGlobalPrefsWorkingStruct();
|
||||
|
||||
// setting cpu_usage_limit to 100
|
||||
// preference got remove from UI for two reasons:
|
||||
// - science apps would crash (timeout)
|
||||
// - wakelock and foreground service would be frequently acquired / released
|
||||
// hard-wire to 100% in case user has changed this preference manually before
|
||||
// it got removed from the UI
|
||||
// TODO needs to be removed when migrating override prefs to common mechanism
|
||||
if(clientPrefs != null) {
|
||||
clientPrefs.cpu_usage_limit = 100.0;
|
||||
rpc.setGlobalPrefsOverrideStruct(clientPrefs);
|
||||
// TODO -- end of stuff to be removed
|
||||
|
||||
status.setPrefs(clientPrefs);
|
||||
}
|
||||
status.setPrefs(clientPrefs);
|
||||
// read supported projects
|
||||
readAndroidProjectsList();
|
||||
// set Android model as hostinfo
|
||||
|
@ -373,7 +359,8 @@ public class Monitor extends Service {
|
|||
// wake locks and foreground enabled when Client is not suspended, therefore also during
|
||||
// idle.
|
||||
CcStatus status = rpc.getCcStatus();
|
||||
Boolean computing = (status.task_suspend_reason == BOINCDefs.SUSPEND_NOT_SUSPENDED);
|
||||
// treat cpu throttling as if it was computing
|
||||
Boolean computing = (status.task_suspend_reason == BOINCDefs.SUSPEND_NOT_SUSPENDED) || (status.task_suspend_reason == BOINCDefs.SUSPEND_REASON_CPU_THROTTLE);
|
||||
if(Logging.VERBOSE) Log.d(Logging.TAG,"readClientStatus(): computation enabled: " + computing);
|
||||
Monitor.getClientStatus().setWifiLock(computing);
|
||||
Monitor.getClientStatus().setWakeLock(computing);
|
||||
|
|
Loading…
Reference in New Issue