mirror of https://github.com/BOINC/boinc.git
take fraction_done into account for calculating seconds of work required
svn path=/trunk/boinc/; revision=2062
This commit is contained in:
parent
b557a97fda
commit
9829e65cc9
14
client/app.C
14
client/app.C
|
@ -807,6 +807,20 @@ ACTIVE_TASK* ACTIVE_TASK_SET::lookup_pid(int pid) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// Find the ACTIVE_TASK in the current set with the matching result
|
||||
//
|
||||
ACTIVE_TASK* ACTIVE_TASK_SET::lookup_result(RESULT* result) {
|
||||
for (active_tasks_v::iterator i = active_tasks.begin();
|
||||
i != active_tasks.end(); ++i)
|
||||
{
|
||||
ACTIVE_TASK* atp = *i;
|
||||
if (atp->result == result) {
|
||||
return atp;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// suspend all currently running tasks
|
||||
//
|
||||
void ACTIVE_TASK_SET::suspend_all() {
|
||||
|
|
18
client/app.h
18
client/app.h
|
@ -2,18 +2,18 @@
|
|||
// Version 1.0 (the "License"); you may not use this file except in
|
||||
// compliance with the License. You may obtain a copy of the License at
|
||||
// http://boinc.berkeley.edu/license_1.0.txt
|
||||
//
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS"
|
||||
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing rights and limitations
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
//
|
||||
|
||||
|
@ -129,11 +129,13 @@ public:
|
|||
|
||||
class ACTIVE_TASK_SET {
|
||||
public:
|
||||
vector<ACTIVE_TASK*> active_tasks;
|
||||
typedef vector<ACTIVE_TASK*> active_tasks_v;
|
||||
active_tasks_v active_tasks;
|
||||
int insert(ACTIVE_TASK*);
|
||||
int remove(ACTIVE_TASK*);
|
||||
int wait_for_exit(double);
|
||||
ACTIVE_TASK* lookup_pid(int);
|
||||
ACTIVE_TASK* lookup_result(RESULT*);
|
||||
bool poll();
|
||||
void suspend_all();
|
||||
void unsuspend_all();
|
||||
|
|
|
@ -523,6 +523,19 @@ double CLIENT_STATE::estimate_cpu_time(WORKUNIT& wu) {
|
|||
return x;
|
||||
}
|
||||
|
||||
inline double force_fraction(double f)
|
||||
{
|
||||
if (f < 0) return 0;
|
||||
if (f > 1) return 1;
|
||||
return f;
|
||||
}
|
||||
|
||||
double CLIENT_STATE::get_percent_done(RESULT* result)
|
||||
{
|
||||
ACTIVE_TASK* atp = active_tasks.lookup_result(result);
|
||||
return atp ? force_fraction(atp->fraction_done) : 0.0;
|
||||
}
|
||||
|
||||
// returns true if start_hour == end_hour or start_hour <= now < end_hour
|
||||
inline bool now_between_two_hours(int start_hour, int end_hour)
|
||||
{
|
||||
|
|
|
@ -95,6 +95,7 @@ public:
|
|||
int check_cpu_benchmarks();
|
||||
void trunc_stderr_stdout();
|
||||
double estimate_cpu_time(WORKUNIT&);
|
||||
double get_percent_done(RESULT* result);
|
||||
int project_disk_usage(PROJECT*, double&);
|
||||
int current_disk_usage(double&);
|
||||
// returns the total disk usage of BOINC on this host
|
||||
|
@ -204,7 +205,7 @@ private:
|
|||
bool some_project_rpc_ok();
|
||||
bool scheduler_rpc_poll();
|
||||
void update_avg_cpu(PROJECT*);
|
||||
double estimate_duration(WORKUNIT*);
|
||||
// double estimate_duration(WORKUNIT*);
|
||||
double current_work_buf_days();
|
||||
|
||||
// the following could be eliminated by using map instead of vector
|
||||
|
|
|
@ -60,7 +60,7 @@ double CLIENT_STATE::current_work_buf_days() {
|
|||
// Don't count result if we've already computed it
|
||||
if (rp->state >= RESULT_COMPUTE_DONE) continue;
|
||||
// TODO: subtract time already finished for WUs in progress
|
||||
seconds_remaining += estimate_cpu_time(*rp->wup);
|
||||
seconds_remaining += estimate_cpu_time(*rp->wup) * get_percent_done(rp);
|
||||
}
|
||||
return (seconds_remaining / SECONDS_PER_DAY);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue