mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=4328
This commit is contained in:
parent
4fe1dab9bb
commit
37adf79297
|
@ -247,37 +247,31 @@ int boinc_parse_init_data_file() {
|
|||
FILE* f;
|
||||
int retval;
|
||||
|
||||
// If in standalone mode, use init files if they're there,
|
||||
// but don't demand that they exist
|
||||
//
|
||||
memset(&aid, 0, sizeof(aid));
|
||||
safe_strncpy(aid.user_name, "Unknown user", sizeof(aid.user_name));
|
||||
safe_strncpy(aid.team_name, "Unknown team", sizeof(aid.team_name));
|
||||
aid.wu_cpu_time = 1000;
|
||||
aid.user_total_credit = 1000;
|
||||
aid.user_expavg_credit = 500;
|
||||
aid.host_total_credit = 1000;
|
||||
aid.host_expavg_credit = 500;
|
||||
aid.checkpoint_period = DEFAULT_CHECKPOINT_PERIOD;
|
||||
aid.fraction_done_update_period = DEFAULT_FRACTION_DONE_UPDATE_PERIOD;
|
||||
|
||||
if (!boinc_file_exists(INIT_DATA_FILE)) {
|
||||
if (standalone) {
|
||||
safe_strncpy(aid.project_preferences, "", sizeof(aid.project_preferences));
|
||||
safe_strncpy(aid.user_name, "Unknown user", sizeof(aid.user_name));
|
||||
safe_strncpy(aid.team_name, "Unknown team", sizeof(aid.team_name));
|
||||
aid.wu_cpu_time = 1000;
|
||||
aid.user_total_credit = 1000;
|
||||
aid.user_expavg_credit = 500;
|
||||
aid.host_total_credit = 1000;
|
||||
aid.host_expavg_credit = 500;
|
||||
aid.checkpoint_period = DEFAULT_CHECKPOINT_PERIOD;
|
||||
aid.fraction_done_update_period = DEFAULT_FRACTION_DONE_UPDATE_PERIOD;
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"boinc_parse_init_data_file(): can't open init data file\n"
|
||||
);
|
||||
return ERR_FOPEN;
|
||||
}
|
||||
} else {
|
||||
f = boinc_fopen(INIT_DATA_FILE, "r");
|
||||
retval = parse_init_data_file(f, aid);
|
||||
fclose(f);
|
||||
if (retval) {
|
||||
fprintf(stderr,
|
||||
"boinc_parse_init_data_file(): can't parse init data file\n"
|
||||
);
|
||||
return retval;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"Can't open init data file - running in standalone mode\n"
|
||||
);
|
||||
return ERR_FOPEN;
|
||||
}
|
||||
f = boinc_fopen(INIT_DATA_FILE, "r");
|
||||
retval = parse_init_data_file(f, aid);
|
||||
fclose(f);
|
||||
if (retval) {
|
||||
fprintf(stderr,
|
||||
"Can't parse init data file - running in standalone mode\n"
|
||||
);
|
||||
return retval;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -112,12 +112,12 @@ static void make_new_window(int mode){
|
|||
strcpy(aid.app_name, "BOINC Application");
|
||||
}
|
||||
win = glutCreateWindow(aid.app_name);
|
||||
|
||||
glutReshapeFunc(app_graphics_resize);
|
||||
glutKeyboardFunc(keyboardD);
|
||||
glutKeyboardUpFunc(keyboardU);
|
||||
glutMouseFunc(mouse_click);
|
||||
glutMotionFunc(mouse_click_move);
|
||||
//glutCloseFunc(close_func);
|
||||
glutDisplayFunc(maybe_render);
|
||||
|
||||
app_graphics_init();
|
||||
|
@ -143,10 +143,18 @@ void set_mode(int mode) {
|
|||
if (mode != MODE_HIDE_GRAPHICS) {
|
||||
make_new_window(mode);
|
||||
}
|
||||
|
||||
// tell the core client that we're entering new mode
|
||||
//
|
||||
if (app_client_shm) {
|
||||
}
|
||||
|
||||
static void wait_for_initial_message() {
|
||||
app_client_shm->shm->graphics_reply.send_msg(
|
||||
xml_graphics_modes[MODE_HIDE_GRAPHICS]
|
||||
);
|
||||
acked_graphics_mode = MODE_HIDE_GRAPHICS;
|
||||
while (1) {
|
||||
if (app_client_shm->shm->graphics_request.has_msg()) {
|
||||
break;
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +202,8 @@ void xwin_graphics_event_loop(){
|
|||
if (boinc_is_standalone()) {
|
||||
set_mode(MODE_WINDOW);
|
||||
} else {
|
||||
set_mode(MODE_HIDE_GRAPHICS);
|
||||
wait_for_initial_message();
|
||||
timer_handler(0);
|
||||
}
|
||||
glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0);
|
||||
glutMainLoop();
|
||||
|
|
|
@ -18369,3 +18369,54 @@ David 13 Oct 2004
|
|||
|
||||
sched/
|
||||
file_upload_handler.C
|
||||
|
||||
David 14 Oct 2004
|
||||
- Core client: change the poll paradigm a little
|
||||
OLD: all the poll functions get called,
|
||||
at least once a second or more often when there's activity,
|
||||
e.g. network traffic.
|
||||
The problem: some of the poll functions (e.g. garbage collect)
|
||||
do a lot of work, and in periods of network activity
|
||||
they get called hundreds of times/sec.
|
||||
NEW: all poll functions take a "double now" argument.
|
||||
Those that only need to run every second can
|
||||
keep track of the last time called, and return false
|
||||
if not enough time has gone by
|
||||
- Clarify meaning of TIME_STATS::active_frac:
|
||||
it is the fraction of total time
|
||||
(NOT time that core client is running)
|
||||
that core client is enabled to work
|
||||
- CLIENT_STATE::compute_work_requests():
|
||||
Don't divide by active_frac in computing work request;
|
||||
the scheduler already does this!!
|
||||
- Core client: don't use time_t for times. Use double.
|
||||
- garbage collect: delete an unused FILE_INFO even if
|
||||
it has an active PERS_FILE_XFER.
|
||||
(Delete the PERS_FILE_XFER first.)
|
||||
- API: fix crashing bug if app_init_data.xml file isn't there
|
||||
- Graphics API, X version: wait for initial message
|
||||
before doing anything (since GLUT needs a window)
|
||||
- scheduler: fix small error in WU wallclock estimate
|
||||
|
||||
api/
|
||||
boinc_api.C
|
||||
x_opengl.C
|
||||
client/
|
||||
app.C,h
|
||||
client_state.C,h
|
||||
client_types.C
|
||||
cs_apps.C
|
||||
cs_files.C
|
||||
cs_scheduler.C
|
||||
file_xfer.C,h
|
||||
gui_rpc_server.C,h
|
||||
http.C,h
|
||||
main.C
|
||||
net_xfer.C,h
|
||||
scheduler_op.C
|
||||
time_stats.h
|
||||
lib/
|
||||
app_ipc.C,h
|
||||
makefile.gui_test
|
||||
sched/
|
||||
sched_send.C
|
||||
|
|
|
@ -186,8 +186,11 @@ void ACTIVE_TASK_SET::free_mem() {
|
|||
// - check if any has exited, and clean up
|
||||
// - see if any has exceeded its CPU or disk space limits, and abort it
|
||||
//
|
||||
bool ACTIVE_TASK_SET::poll() {
|
||||
bool ACTIVE_TASK_SET::poll(double now) {
|
||||
bool action;
|
||||
static double last_time = 0;
|
||||
if (now - last_time < 1.0) return false;
|
||||
last_time = now;
|
||||
|
||||
action = check_app_exited();
|
||||
send_heartbeats();
|
||||
|
|
|
@ -186,7 +186,7 @@ public:
|
|||
int remove(ACTIVE_TASK*);
|
||||
ACTIVE_TASK* lookup_pid(int);
|
||||
ACTIVE_TASK* lookup_result(RESULT*);
|
||||
bool poll();
|
||||
bool poll(double);
|
||||
void suspend_all(bool leave_apps_in_memory=true);
|
||||
void unsuspend_all();
|
||||
bool is_task_executing();
|
||||
|
|
|
@ -322,9 +322,9 @@ int CLIENT_STATE::net_sleep(double x) {
|
|||
}
|
||||
}
|
||||
|
||||
#define POLL_ACTION(name, func) \
|
||||
do { if (func()) { \
|
||||
++actions; \
|
||||
#define POLL_ACTION(name, func) \
|
||||
do { if (func(now)) { \
|
||||
++actions; \
|
||||
scope_messages.printf("CLIENT_STATE::do_something(): active task: " #name "\n"); \
|
||||
} } while(0)
|
||||
|
||||
|
@ -333,7 +333,7 @@ int CLIENT_STATE::net_sleep(double x) {
|
|||
// Returns true if something happened
|
||||
// (in which case should call this again immediately)
|
||||
//
|
||||
bool CLIENT_STATE::do_something() {
|
||||
bool CLIENT_STATE::do_something(double now) {
|
||||
int actions = 0, reason, retval;
|
||||
SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_POLL);
|
||||
|
||||
|
@ -364,7 +364,7 @@ bool CLIENT_STATE::do_something() {
|
|||
} else {
|
||||
cpu_benchmarks_poll();
|
||||
}
|
||||
return gui_rpcs.poll();
|
||||
return gui_rpcs.poll(dtime());
|
||||
}
|
||||
|
||||
check_suspend_network(reason);
|
||||
|
@ -707,7 +707,7 @@ void CLIENT_STATE::print_summary() {
|
|||
|
||||
// delete unneeded records and files
|
||||
//
|
||||
bool CLIENT_STATE::garbage_collect() {
|
||||
bool CLIENT_STATE::garbage_collect(double now) {
|
||||
unsigned int i, j;
|
||||
int failnum;
|
||||
FILE_INFO* fip;
|
||||
|
@ -723,6 +723,12 @@ bool CLIENT_STATE::garbage_collect() {
|
|||
PROJECT* project;
|
||||
char buf[1024];
|
||||
|
||||
static double last_time=0;
|
||||
if (now>0) {
|
||||
if (now - last_time < 1.0) return false;
|
||||
last_time = now;
|
||||
}
|
||||
|
||||
SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_STATE);
|
||||
|
||||
// zero references counts on WUs, FILE_INFOs and APP_VERSIONs
|
||||
|
@ -874,7 +880,12 @@ bool CLIENT_STATE::garbage_collect() {
|
|||
fip = *fi_iter;
|
||||
// if there was an error with a permanent file, get rid of its file_info
|
||||
if (fip->status < 0) fip->sticky = false;
|
||||
if (fip->ref_cnt==0 && fip->pers_file_xfer==NULL && !fip->sticky) {
|
||||
if (fip->ref_cnt==0 && !fip->sticky) {
|
||||
if (fip->pers_file_xfer) {
|
||||
pers_file_xfers->remove(fip->pers_file_xfer);
|
||||
delete fip->pers_file_xfer;
|
||||
fip->pers_file_xfer = 0;
|
||||
}
|
||||
#if 0
|
||||
fip->project->size -= fip->nbytes;
|
||||
#endif
|
||||
|
@ -900,10 +911,14 @@ bool CLIENT_STATE::garbage_collect() {
|
|||
|
||||
// update the state of results
|
||||
//
|
||||
bool CLIENT_STATE::update_results() {
|
||||
bool CLIENT_STATE::update_results(double now) {
|
||||
RESULT* rp;
|
||||
vector<RESULT*>::iterator result_iter;
|
||||
bool action = false;
|
||||
static double last_time=0;
|
||||
|
||||
if (now - last_time < 1.0) return false;
|
||||
last_time = 0;
|
||||
|
||||
result_iter = results.begin();
|
||||
while (result_iter != results.end()) {
|
||||
|
@ -947,8 +962,8 @@ bool CLIENT_STATE::update_results() {
|
|||
bool CLIENT_STATE::time_to_exit() {
|
||||
if (!exit_when_idle && !exit_after_app_start_secs) return false;
|
||||
if (exit_after_app_start_secs
|
||||
&& app_started
|
||||
&& (difftime(time(0), app_started) >= exit_after_app_start_secs)
|
||||
&& (app_started>0)
|
||||
&& ((dtime() - app_started) >= exit_after_app_start_secs)
|
||||
) {
|
||||
msg_printf(NULL, MSG_INFO, "exiting because time is up: %d\n", exit_after_app_start_secs);
|
||||
return true;
|
||||
|
@ -1104,7 +1119,7 @@ int CLIENT_STATE::reset_project(PROJECT* project) {
|
|||
}
|
||||
}
|
||||
|
||||
garbage_collect();
|
||||
garbage_collect(0);
|
||||
|
||||
// forcibly remove apps and app_versions
|
||||
// (but not if anonymous platform)
|
||||
|
@ -1131,7 +1146,7 @@ int CLIENT_STATE::reset_project(PROJECT* project) {
|
|||
app_iter++;
|
||||
}
|
||||
}
|
||||
garbage_collect();
|
||||
garbage_collect(0);
|
||||
}
|
||||
|
||||
write_state_file();
|
||||
|
|
|
@ -133,19 +133,19 @@ private:
|
|||
// if set, run benchmarks on client startup
|
||||
int exit_after_app_start_secs;
|
||||
// if nonzero, exit this many seconds after starting an app
|
||||
time_t app_started;
|
||||
double app_started;
|
||||
// when the most recent app was started
|
||||
|
||||
// CPU sched state
|
||||
//
|
||||
time_t cpu_sched_last_time;
|
||||
double cpu_sched_last_time;
|
||||
double cpu_sched_work_done_this_period;
|
||||
|
||||
// --------------- client_state.C:
|
||||
public:
|
||||
CLIENT_STATE();
|
||||
int init();
|
||||
bool do_something();
|
||||
bool do_something(double t);
|
||||
// Initiates and completes actions (file transfers, process executions)
|
||||
// Never blocks.
|
||||
// Returns true if it actually did something,
|
||||
|
@ -172,8 +172,8 @@ private:
|
|||
int link_workunit(PROJECT*, WORKUNIT*);
|
||||
int link_result(PROJECT*, RESULT*);
|
||||
void print_summary();
|
||||
bool garbage_collect();
|
||||
bool update_results();
|
||||
bool garbage_collect(double);
|
||||
bool update_results(double);
|
||||
double total_resource_share();
|
||||
|
||||
// --------------- cs_account.C:
|
||||
|
@ -202,8 +202,8 @@ private:
|
|||
void assign_results_to_projects();
|
||||
bool schedule_largest_debt_project(double expected_pay_off);
|
||||
bool start_apps();
|
||||
bool schedule_cpus();
|
||||
bool handle_finished_apps();
|
||||
bool schedule_cpus(double);
|
||||
bool handle_finished_apps(double);
|
||||
void handle_file_xfer_apps();
|
||||
int schedule_result(RESULT*);
|
||||
|
||||
|
@ -227,7 +227,7 @@ public:
|
|||
bool start_new_file_xfer(PERS_FILE_XFER&);
|
||||
private:
|
||||
int make_project_dirs();
|
||||
bool handle_pers_file_xfers();
|
||||
bool handle_pers_file_xfers(double);
|
||||
|
||||
// --------------- cs_prefs.C:
|
||||
public:
|
||||
|
@ -262,7 +262,7 @@ private:
|
|||
PROJECT* find_project_with_overdue_results();
|
||||
PROJECT* next_project_sched_rpc_pending();
|
||||
bool some_project_rpc_ok();
|
||||
bool scheduler_rpc_poll();
|
||||
bool scheduler_rpc_poll(double);
|
||||
double ettprc(PROJECT*, int);
|
||||
double avg_proc_rate(PROJECT*);
|
||||
|
||||
|
|
|
@ -410,7 +410,7 @@ FILE_INFO::FILE_INFO() {
|
|||
|
||||
FILE_INFO::~FILE_INFO() {
|
||||
if (pers_file_xfer) {
|
||||
msg_printf(NULL, MSG_ERROR, "FILE_INFO::~FILE_INFO(): removing FILE_INFO when a pers_file_xfer still points to me\n");
|
||||
msg_printf(NULL, MSG_ERROR, "%s: delete FILE_INFO when a pers_file_xfer still points to it\n", name);
|
||||
pers_file_xfer->fip = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,10 +143,13 @@ int CLIENT_STATE::app_finished(ACTIVE_TASK& at) {
|
|||
|
||||
// clean up after finished apps
|
||||
//
|
||||
bool CLIENT_STATE::handle_finished_apps() {
|
||||
bool CLIENT_STATE::handle_finished_apps(double now) {
|
||||
unsigned int i;
|
||||
ACTIVE_TASK* atp;
|
||||
bool action = false;
|
||||
static double last_time = 0;
|
||||
if (now - last_time < 1.0) return false;
|
||||
last_time = now;
|
||||
|
||||
SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_TASK);
|
||||
|
||||
|
@ -327,15 +330,15 @@ bool CLIENT_STATE::schedule_largest_debt_project(double expected_pay_off) {
|
|||
// and whenever all the input files for a result finish downloading
|
||||
// (with must_reschedule=true)
|
||||
//
|
||||
bool CLIENT_STATE::schedule_cpus() {
|
||||
bool CLIENT_STATE::schedule_cpus(double now) {
|
||||
double expected_pay_off;
|
||||
ACTIVE_TASK *atp;
|
||||
PROJECT *p;
|
||||
bool some_app_started = false, first;
|
||||
double total_resource_share;
|
||||
int retval, elapsed_time, j;
|
||||
int retval, j;
|
||||
double min_debt=0;
|
||||
double vm_limit;
|
||||
double vm_limit, elapsed_time;
|
||||
unsigned int i;
|
||||
|
||||
SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_TASK);
|
||||
|
@ -350,11 +353,12 @@ bool CLIENT_STATE::schedule_cpus() {
|
|||
if (must_schedule_cpus) {
|
||||
must_schedule_cpus = false;
|
||||
} else {
|
||||
elapsed_time = time(0) - cpu_sched_last_time;
|
||||
elapsed_time = now - cpu_sched_last_time;
|
||||
if (elapsed_time < (global_prefs.cpu_scheduling_period_minutes*60)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
cpu_sched_last_time = now;
|
||||
|
||||
// mark file xfer results as completed;
|
||||
// TODO: why do this here??
|
||||
|
@ -503,9 +507,8 @@ bool CLIENT_STATE::schedule_cpus() {
|
|||
}
|
||||
cpu_sched_work_done_this_period = 0;
|
||||
|
||||
cpu_sched_last_time = time(0);
|
||||
if (some_app_started) {
|
||||
app_started = cpu_sched_last_time;
|
||||
app_started = now;
|
||||
}
|
||||
|
||||
// debts and active_tasks can only change if some project had a runnable result
|
||||
|
|
|
@ -162,12 +162,16 @@ int FILE_INFO::verify_downloaded_file() {
|
|||
// scan all FILE_INFOs and PERS_FILE_XFERs.
|
||||
// start and finish downloads and uploads as needed.
|
||||
//
|
||||
bool CLIENT_STATE::handle_pers_file_xfers() {
|
||||
bool CLIENT_STATE::handle_pers_file_xfers(double now) {
|
||||
unsigned int i;
|
||||
FILE_INFO* fip;
|
||||
PERS_FILE_XFER *pfx;
|
||||
bool action = false;
|
||||
int retval;
|
||||
static double last_time;
|
||||
|
||||
if (now - last_time < 1.0) return false;
|
||||
last_time = now;
|
||||
|
||||
// Look for FILE_INFOs for which we should start a transfer,
|
||||
// and make PERS_FILE_XFERs for them
|
||||
|
|
|
@ -343,9 +343,7 @@ bool CLIENT_STATE::some_project_rpc_ok() {
|
|||
// for project p in a second of (wall-clock) time
|
||||
//
|
||||
double CLIENT_STATE::avg_proc_rate(PROJECT *p) {
|
||||
return (p->resource_share / trs)
|
||||
* ncpus
|
||||
* time_stats.on_frac * time_stats.active_frac;
|
||||
return (p->resource_share / trs) * ncpus * time_stats.active_frac;
|
||||
}
|
||||
|
||||
// "estimated time to project result count"
|
||||
|
@ -411,24 +409,26 @@ int CLIENT_STATE::compute_work_requests() {
|
|||
//
|
||||
if (estimated_time_to_starvation < work_min_period) {
|
||||
if (estimated_time_to_starvation == 0) {
|
||||
// msg_printf(p, MSG_INFO, "Will starve!");
|
||||
msg_printf(p, MSG_INFO, "is starved");
|
||||
urgency = NEED_WORK_IMMEDIATELY;
|
||||
} else {
|
||||
// msg_printf(p, MSG_INFO, "Will starve in %.2fs!",
|
||||
// estimated_time_to_starvation
|
||||
// );
|
||||
msg_printf(p, MSG_INFO, "will starve in %.2f sec",
|
||||
estimated_time_to_starvation
|
||||
);
|
||||
urgency = max(NEED_WORK, urgency);
|
||||
}
|
||||
}
|
||||
|
||||
// determine work requests for each project
|
||||
// NOTE: don't need to divide by active_frac etc.;
|
||||
// the scheduler does that (see sched/sched_send.C)
|
||||
//
|
||||
p->work_request =
|
||||
max(0.0,
|
||||
//(2*work_min_period - estimated_time_to_starvation)
|
||||
(work_min_period - estimated_time_to_starvation)
|
||||
* avg_proc_rate(p)
|
||||
);
|
||||
p->work_request = max(0.0,
|
||||
//(2*work_min_period - estimated_time_to_starvation)
|
||||
(work_min_period - estimated_time_to_starvation)
|
||||
* ncpus
|
||||
);
|
||||
//msg_printf(p, MSG_INFO, "work req: %f sec", p->work_request);
|
||||
}
|
||||
|
||||
if (urgency == DONT_NEED_WORK) {
|
||||
|
@ -443,10 +443,14 @@ int CLIENT_STATE::compute_work_requests() {
|
|||
// called from the client's polling loop.
|
||||
// initiate scheduler RPC activity if needed and possible
|
||||
//
|
||||
bool CLIENT_STATE::scheduler_rpc_poll() {
|
||||
bool CLIENT_STATE::scheduler_rpc_poll(double now) {
|
||||
int urgency = DONT_NEED_WORK;
|
||||
PROJECT *p;
|
||||
bool action=false;
|
||||
static double last_time=0;
|
||||
|
||||
if (now - last_time < 1.0) return false;
|
||||
last_time = now;
|
||||
|
||||
switch(scheduler_op->state) {
|
||||
case SCHEDULER_OP_STATE_IDLE:
|
||||
|
|
|
@ -184,10 +184,14 @@ int FILE_XFER_SET::remove(FILE_XFER* fxp) {
|
|||
// Run through the FILE_XFER_SET and determine if any of the file
|
||||
// transfers are complete or had an error
|
||||
//
|
||||
bool FILE_XFER_SET::poll() {
|
||||
bool FILE_XFER_SET::poll(double now) {
|
||||
unsigned int i;
|
||||
FILE_XFER* fxp;
|
||||
bool action = false;
|
||||
static double last_time=0;
|
||||
|
||||
if (now - last_time < 1.0) return false;
|
||||
last_time = now;
|
||||
|
||||
SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_FILE_XFER);
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
FILE_XFER_SET(HTTP_OP_SET*);
|
||||
int insert(FILE_XFER*);
|
||||
int remove(FILE_XFER*);
|
||||
bool poll();
|
||||
bool poll(double);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -558,7 +558,7 @@ int GUI_RPC_CONN_SET::init() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool GUI_RPC_CONN_SET::poll() {
|
||||
bool GUI_RPC_CONN_SET::poll(double) {
|
||||
int n = 0;
|
||||
unsigned int i;
|
||||
fd_set read_fds, error_fds;
|
||||
|
|
|
@ -34,7 +34,7 @@ class GUI_RPC_CONN_SET {
|
|||
int get_allowed_hosts();
|
||||
int insert(GUI_RPC_CONN*);
|
||||
public:
|
||||
bool poll();
|
||||
bool poll(double);
|
||||
int init();
|
||||
};
|
||||
|
||||
|
|
|
@ -496,7 +496,7 @@ int HTTP_OP_SET::insert(HTTP_OP* ho) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool HTTP_OP_SET::poll() {
|
||||
bool HTTP_OP_SET::poll(double) {
|
||||
unsigned int i;
|
||||
HTTP_OP* htp;
|
||||
int n, retval;
|
||||
|
|
|
@ -96,7 +96,7 @@ class HTTP_OP_SET {
|
|||
NET_XFER_SET* net_xfers;
|
||||
public:
|
||||
HTTP_OP_SET(NET_XFER_SET*);
|
||||
bool poll();
|
||||
bool poll(double);
|
||||
int insert(HTTP_OP*);
|
||||
int remove(HTTP_OP*);
|
||||
};
|
||||
|
|
|
@ -272,7 +272,8 @@ int boinc_main_loop(int argc, char** argv) {
|
|||
|
||||
|
||||
while (1) {
|
||||
if (!gstate.do_something()) {
|
||||
dt = dtime();
|
||||
if (!gstate.do_something(dt)) {
|
||||
dt = dtime();
|
||||
gstate.net_sleep(1.);
|
||||
dt = dtime() - dt;
|
||||
|
|
|
@ -349,12 +349,11 @@ int NET_XFER_SET::remove(NET_XFER* nxp) {
|
|||
|
||||
// Transfer data to/from active sockets.
|
||||
// Keep doing I/O until would block, or we hit rate limits,
|
||||
// or about .5 second goes by
|
||||
// or .5 second goes by
|
||||
//
|
||||
bool NET_XFER_SET::poll() {
|
||||
bool NET_XFER_SET::poll(double now) {
|
||||
double bytes_xferred;
|
||||
int retval;
|
||||
time_t t = time(0);
|
||||
bool action = false;
|
||||
|
||||
while (1) {
|
||||
|
@ -362,7 +361,7 @@ bool NET_XFER_SET::poll() {
|
|||
if (retval) break;
|
||||
if (bytes_xferred == 0) break;
|
||||
action = true;
|
||||
if (time(0) != t) break;
|
||||
if ((dtime() - now) > 0.5) break;
|
||||
}
|
||||
return action;
|
||||
}
|
||||
|
@ -382,7 +381,7 @@ int NET_XFER_SET::net_sleep(double x) {
|
|||
retval = do_select(bytes_xferred, x);
|
||||
if (retval) return retval;
|
||||
if (bytes_xferred) {
|
||||
return poll();
|
||||
return poll(dtime());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
time_t last_time;
|
||||
int insert(NET_XFER*);
|
||||
int remove(NET_XFER*);
|
||||
bool poll();
|
||||
bool poll(double);
|
||||
int net_sleep(double);
|
||||
int do_select(double& bytes_transferred, double timeout);
|
||||
NET_XFER* lookup_fd(int); // lookup by fd
|
||||
|
|
|
@ -171,7 +171,7 @@ int PERS_FILE_XFER::start_xfer() {
|
|||
// If it's time to start it, then attempt to start it.
|
||||
// If it has finished or failed, then deal with it appropriately
|
||||
//
|
||||
bool PERS_FILE_XFER::poll(time_t now) {
|
||||
bool PERS_FILE_XFER::poll(double now) {
|
||||
int retval;
|
||||
char pathname[256], buf[256];
|
||||
double existing_size = 0;
|
||||
|
@ -187,7 +187,7 @@ bool PERS_FILE_XFER::poll(time_t now) {
|
|||
// See if it's time to try again.
|
||||
//
|
||||
if (now >= next_request_time) {
|
||||
last_time = dtime();
|
||||
last_time = now;
|
||||
fip->upload_offset = -1;
|
||||
retval = start_xfer();
|
||||
return (retval == 0);
|
||||
|
@ -198,11 +198,11 @@ bool PERS_FILE_XFER::poll(time_t now) {
|
|||
|
||||
// don't count suspended periods in total time
|
||||
//
|
||||
double diff = dtime() - last_time;
|
||||
double diff = now - last_time;
|
||||
if (diff <= 2) {
|
||||
time_so_far += diff;
|
||||
}
|
||||
last_time = dtime();
|
||||
last_time = now;
|
||||
|
||||
if (fxp->file_xfer_done) {
|
||||
if (fip->nbytes) {
|
||||
|
@ -469,10 +469,13 @@ PERS_FILE_XFER_SET::PERS_FILE_XFER_SET(FILE_XFER_SET* p) {
|
|||
// Run through the set, starting any transfers that need to be
|
||||
// started and deleting any that have finished
|
||||
//
|
||||
bool PERS_FILE_XFER_SET::poll() {
|
||||
bool PERS_FILE_XFER_SET::poll(double now) {
|
||||
unsigned int i;
|
||||
bool action = false;
|
||||
int now = time(0);
|
||||
static double last_time=0;
|
||||
|
||||
if (now - last_time < 1.0) return false;
|
||||
last_time = now;
|
||||
|
||||
for (i=0; i<pers_file_xfers.size(); i++) {
|
||||
action |= pers_file_xfers[i]->poll(now);
|
||||
|
|
|
@ -20,10 +20,6 @@
|
|||
#ifndef _PERS_FILE_XFER_H
|
||||
#define _PERS_FILE_XFER_H
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include "client_types.h"
|
||||
#include "file_xfer.h"
|
||||
|
||||
|
@ -66,7 +62,7 @@ public:
|
|||
PERS_FILE_XFER();
|
||||
~PERS_FILE_XFER();
|
||||
int init(FILE_INFO*, bool is_file_upload);
|
||||
bool poll(time_t now);
|
||||
bool poll(double);
|
||||
void handle_xfer_failure();
|
||||
void retry_or_backoff();
|
||||
void check_giveup(char*);
|
||||
|
@ -85,7 +81,7 @@ public:
|
|||
PERS_FILE_XFER_SET(FILE_XFER_SET*);
|
||||
int insert(PERS_FILE_XFER*);
|
||||
int remove(PERS_FILE_XFER*);
|
||||
bool poll();
|
||||
bool poll(double);
|
||||
void suspend();
|
||||
};
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ bool SCHEDULER_OP::check_master_fetch_start() {
|
|||
return false;
|
||||
}
|
||||
|
||||
// try to get some work, from any project from which we need it
|
||||
// try to get work, from any project from which we need it
|
||||
// PRECONDITION: compute_work_requests() has been called
|
||||
// to fill in PROJECT::work_request
|
||||
//
|
||||
|
@ -87,11 +87,8 @@ int SCHEDULER_OP::init_get_work() {
|
|||
must_get_work = true;
|
||||
project = gstate.next_project_need_work(0);
|
||||
if (project) {
|
||||
// for new work fetch policy
|
||||
ns = project->work_request;
|
||||
msg_printf(project, MSG_INFO,
|
||||
"Requesting %.0f seconds of work", ns
|
||||
);
|
||||
msg_printf(project, MSG_INFO, "Requesting %.2f seconds of work", ns);
|
||||
retval = init_op_project(ns);
|
||||
if (retval) {
|
||||
sprintf(err_msg, "init_op_project failed, error %d\n", retval);
|
||||
|
|
|
@ -25,13 +25,11 @@ class TIME_STATS {
|
|||
public:
|
||||
// we maintain an exponentially weighted average of these quantities:
|
||||
double on_frac;
|
||||
// the fraction of time this host runs the core client
|
||||
// the fraction of total time this host runs the core client
|
||||
double connected_frac;
|
||||
// of the time running the core client,
|
||||
// the fraction the host is connected to the Internet
|
||||
// the fraction of total time the host is connected to the Internet
|
||||
double active_frac;
|
||||
// of the time running the core client,
|
||||
// the fraction the core client is able to work
|
||||
// the fraction of total time the core client is able to work
|
||||
// (due to preferences, manual suspend/resume, etc.)
|
||||
|
||||
void update(bool is_connected, bool is_active);
|
||||
|
|
|
@ -177,6 +177,11 @@ bool MSG_CHANNEL::get_msg(char *msg) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool MSG_CHANNEL::has_msg() {
|
||||
if (buf[0]) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MSG_CHANNEL::send_msg(char *msg) {
|
||||
if (buf[0]) return false;
|
||||
safe_strncpy(buf+1, msg, MSG_CHANNEL_SIZE-1);
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
struct MSG_CHANNEL {
|
||||
char buf[MSG_CHANNEL_SIZE];
|
||||
bool get_msg(char*); // returns a message and clears pending flag
|
||||
bool has_msg();
|
||||
bool send_msg(char*); // if there is not a message in the segment,
|
||||
// writes specified message and sets pending flag
|
||||
void send_msg_overwrite(char*);
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
// uncomment the following for Solaris
|
||||
//LIBS = -lnsl -lsocket
|
||||
|
||||
gui_test: gui_test.C gui_rpc_client.C gui_rpc_client.h
|
||||
g++ -g -I../lib -o gui_test -lnsl -lsocket gui_test.C gui_rpc_client.C ../lib/libboinc.a
|
||||
g++ -g -I../lib -o gui_test $(LIBS) gui_test.C gui_rpc_client.C ../lib/libboinc.a
|
||||
|
|
|
@ -136,26 +136,27 @@ const double HOST_ACTIVE_FRAC_MIN = 0.1;
|
|||
//
|
||||
// TODO: improve this. take memory bandwidth into account
|
||||
//
|
||||
inline double estimate_cpu_duration(WORKUNIT& wu, HOST& host) {
|
||||
static double estimate_cpu_duration(WORKUNIT& wu, HOST& host) {
|
||||
if (host.p_fpops <= 0) host.p_fpops = 1e9;
|
||||
if (wu.rsc_fpops_est <= 0) wu.rsc_fpops_est = 1e12;
|
||||
return wu.rsc_fpops_est/host.p_fpops;
|
||||
}
|
||||
|
||||
// estimate the amount of real time for this WU based on active_frac,
|
||||
// and resource_share_fraction
|
||||
inline double estimate_wallclock_duration(
|
||||
// estimate the amount of real time to complete this WU,
|
||||
// taking into account active_frac and resource_share_fraction
|
||||
//
|
||||
static double estimate_wallclock_duration(
|
||||
WORKUNIT& wu, HOST& host, double resource_share_fraction
|
||||
) {
|
||||
return estimate_cpu_duration(wu, host)
|
||||
/ max(HOST_ACTIVE_FRAC_MIN, host.active_frac * resource_share_fraction)
|
||||
/ (max(HOST_ACTIVE_FRAC_MIN, host.active_frac)*resource_share_fraction)
|
||||
;
|
||||
}
|
||||
|
||||
// return false if the WU can't be executed on the host
|
||||
// because of insufficient memory, CPU speed, or resource share
|
||||
//
|
||||
bool wu_is_feasible(
|
||||
static bool wu_is_feasible(
|
||||
WORKUNIT& wu, HOST& host, WORK_REQ& wreq,
|
||||
double resource_share_fraction, double estimated_delay
|
||||
) {
|
||||
|
|
Loading…
Reference in New Issue