*** empty log message ***

svn path=/trunk/boinc/; revision=4423
This commit is contained in:
David Anderson 2004-10-25 20:16:30 +00:00
parent 7370ce0cd0
commit c02e5dfa4a
19 changed files with 104 additions and 83 deletions

View File

@ -98,7 +98,7 @@ static bool heartbeat_active; // if false, suppress heartb
//HANDLE hSuspendRequest;
//HANDLE hResumeRequest;
static HANDLE hSharedMem;
static HANDLE worker_thread_handle;
HANDLE worker_thread_handle;
static MMRESULT timer_id;
#endif

View File

@ -87,13 +87,7 @@ extern APP_INIT_DATA aid;
/////////// IMPLEMENTATION STUFF BEGINS HERE
extern APP_CLIENT_SHM *app_client_shm;
#if 0
#ifdef HAVE_SIGNAL_H
extern void boinc_catch_signal(int signal);
extern void boinc_quit(int sig);
#endif
#endif
extern HANDLE worker_thread_handle;
/////////// IMPLEMENTATION STUFF ENDS HERE

View File

@ -25,7 +25,6 @@
#ifdef _WIN32
#include "boinc_win.h"
extern void win_graphics_event_loop();
HANDLE worker_threadh=NULL;
#endif
#ifdef __APPLE_CC__
@ -96,7 +95,7 @@ int boinc_init_graphics(void (*_worker_main)()) {
// Create the graphics thread, passing it the graphics info
// TODO: is it better to use _beginthreadex here?
//
worker_threadh = CreateThread(
worker_thread_handle = CreateThread(
NULL, 0, foobar, 0, CREATE_SUSPENDED, &threadId
);
@ -107,11 +106,11 @@ int boinc_init_graphics(void (*_worker_main)()) {
// lower worker thread priority
//
SetThreadPriority(worker_threadh, THREAD_PRIORITY_LOWEST);
SetThreadPriority(worker_thread_handle, THREAD_PRIORITY_LOWEST);
// Start the worker thread
//
ResumeThread(worker_threadh);
ResumeThread(worker_thread_handle);
graphics_inited = true;
win_graphics_event_loop();

View File

@ -18798,3 +18798,35 @@ David 22 Oct 2004
client/
client_state.C
cs_apps.C
David 25 Oct 2004
- Use double instead of time_t to represent time;
use dtime() instead of time(0) to get time
- better error message on upload init failure
- add lib/result_state.h to VC project
client/
client_state.C
client_types.h
cs_prefs.C
cs_scheduler.C
net_xfer.h
pers_file_xfer.C,h
schedule_op.C,h
ss_logic.C,h
lib/
util.C,h
win_build/
boinc_gui.vcproj
David 25 Oct 2004
- fixed bug that caused app's reported CPU time to always stay at zero
This is a by-product of recent graphics changes:
boinc_init() was getting the current thread handle and assuming
it's the worker thread, which is not the case now.
Fix: use a single variable for worker thread handle;
if boinc_graphics_init() is called, it changes it
api/
boinc_api.C,h
graphics_api.C

View File

@ -663,7 +663,7 @@ int CLIENT_STATE::link_result(PROJECT* p, RESULT* rp) {
//
void CLIENT_STATE::print_summary() {
unsigned int i;
int t;
double t, now=dtime();
if (!log_flags.state_debug) return;
SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_STATE);
@ -673,7 +673,7 @@ void CLIENT_STATE::print_summary() {
for (i=0; i<projects.size(); i++) {
t = projects[i]->min_rpc_time;
if (t) {
scope_messages.printf(" %s min RPC %d seconds from now\n", projects[i]->master_url, (int)(t-time(0)));
scope_messages.printf(" %s min RPC %f.0 seconds from now\n", projects[i]->master_url, t-now);
} else {
scope_messages.printf(" %s\n", projects[i]->master_url);
}

View File

@ -89,8 +89,8 @@ public:
// this is the signature
#if 0
int priority;
time_t time_last_used; // time of last use of FILE_INFO, update during parsing, writing, or application usage
time_t exp_date;
double time_last_used; // time of last use of FILE_INFO, update during parsing, writing, or application usage
double exp_date;
#endif
std::string error_msg; // if permanent error occurs during file xfer,
// it's recorded here
@ -186,9 +186,9 @@ public:
int nrpc_failures; // # of consecutive times we've failed to
// contact all scheduling servers
int master_fetch_failures;
time_t min_rpc_time; // earliest time to contact any server
double min_rpc_time; // earliest time to contact any server
// of this project (or zero)
time_t min_report_min_rpc_time; // when to next report on min_rpc_time
double min_report_min_rpc_time; // when to next report on min_rpc_time
// (or zero)
bool master_url_fetch_pending;
// need to fetch and parse the master URL
@ -238,9 +238,9 @@ public:
#endif
// set min_rpc_time and have_reported_min_rpc_time
void set_min_rpc_time(time_t future_time);
void set_min_rpc_time(double future_time);
// returns true if min_rpc_time > now; may print a message
bool waiting_until_min_rpc_time(time_t now);
bool waiting_until_min_rpc_time(double now);
};
struct APP {

View File

@ -114,7 +114,6 @@ int CLIENT_STATE::allowed_project_disk_usage(double& size) {
//
inline bool now_between_two_hours(int start_hour, int end_hour) {
if (start_hour == end_hour) {
// always work
return true;
}

View File

@ -69,17 +69,17 @@ const int SECONDS_BEFORE_REPORTING_MIN_RPC_TIME_AGAIN = 60*60;
static int proj_min_results(PROJECT* p, int ncpus) {
return (int)(ceil(ncpus*p->resource_share/trs));
}
void PROJECT::set_min_rpc_time(time_t future_time) {
void PROJECT::set_min_rpc_time(double future_time) {
if (future_time > min_rpc_time) {
min_rpc_time = future_time;
}
min_report_min_rpc_time = 0; // report immediately
min_report_min_rpc_time = 0;
}
// Return true iff we should not contact the project yet.
// Print a message to the user if we haven't recently
//
bool PROJECT::waiting_until_min_rpc_time(time_t now) {
bool PROJECT::waiting_until_min_rpc_time(double now) {
if (min_rpc_time > now ) {
if (now >= min_report_min_rpc_time) {
min_report_min_rpc_time = now + SECONDS_BEFORE_REPORTING_MIN_RPC_TIME_AGAIN;
@ -99,7 +99,7 @@ bool PROJECT::waiting_until_min_rpc_time(time_t now) {
PROJECT* CLIENT_STATE::next_project_master_pending() {
unsigned int i;
PROJECT* p;
time_t now = time(0);
double now = dtime();
for (i=0; i<projects.size(); i++) {
p = projects[i];
@ -115,7 +115,7 @@ PROJECT* CLIENT_STATE::next_project_master_pending() {
//
PROJECT* CLIENT_STATE::next_project_sched_rpc_pending() {
unsigned int i;
time_t now = time(0);
double now = dtime();
for (i=0; i<projects.size(); i++) {
if (projects[i]->waiting_until_min_rpc_time(now)) continue;
@ -133,7 +133,7 @@ PROJECT* CLIENT_STATE::next_project_sched_rpc_pending() {
//
PROJECT* CLIENT_STATE::next_project_need_work(PROJECT *old) {
PROJECT *p;
time_t now = time(0);
double now = dtime();
unsigned int i;
bool found_old = (old == 0);
for (i=0; i<projects.size(); ++i) {
@ -304,7 +304,7 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p, double work_req) {
PROJECT* CLIENT_STATE::find_project_with_overdue_results() {
unsigned int i;
RESULT* r;
time_t now = time(0);
double now = dtime();
for (i=0; i<results.size(); i++) {
r = results[i];
@ -331,7 +331,7 @@ PROJECT* CLIENT_STATE::find_project_with_overdue_results() {
//
bool CLIENT_STATE::some_project_rpc_ok() {
unsigned int i;
time_t now = time(0);
double now = dtime();
for (i=0; i<projects.size(); i++) {
if (projects[i]->min_rpc_time < now) return true;
@ -385,7 +385,7 @@ int CLIENT_STATE::compute_work_requests() {
int urgency = DONT_NEED_WORK;
unsigned int i;
double work_min_period = global_prefs.work_buf_min_days * SECONDS_PER_DAY;
time_t now = time(0);
double now = dtime();
trs = total_resource_share();
@ -520,7 +520,7 @@ int CLIENT_STATE::handle_scheduler_reply(
if (retval) return retval;
if (sr.request_delay) {
time_t x = time(0) + sr.request_delay;
double x = dtime() + sr.request_delay;
if (x > project->min_rpc_time) project->min_rpc_time = x;
}

View File

@ -92,7 +92,7 @@ public:
// total bytes transferred
bool up_active, down_active;
// has there been transfer activity since last call to check_active()?
time_t last_time;
double last_time;
int insert(NET_XFER*);
int remove(NET_XFER*);
bool poll(double);

View File

@ -135,22 +135,17 @@ int PERS_FILE_XFER::start_xfer() {
retval = file_xfer->init_download(*fip);
}
fxp = file_xfer;
if (!retval) retval = gstate.file_xfers->insert(file_xfer);
if (retval) {
msg_printf(
fip->project, MSG_ERROR, "Couldn't start %s for %s: error %d",
(is_upload ? "upload" : "download"), fip->get_current_url(is_upload), retval
fip->project, MSG_ERROR, "Couldn't start %s of %s",
(is_upload ? "upload" : "download"), fip->name
);
handle_xfer_failure();
delete fxp;
fxp = NULL;
return retval;
}
retval = gstate.file_xfers->insert(file_xfer);
if (retval) {
msg_printf(
fip->project, MSG_ERROR, "Couldn't start %s for %s: error %d",
(is_upload ? "upload" : "download"), fip->get_current_url(is_upload), retval
fip->project, MSG_ERROR, "URL %s: error %d",
fip->get_current_url(is_upload), retval
);
fxp->file_xfer_retval = retval;
handle_xfer_failure();
delete fxp;
@ -322,7 +317,7 @@ void PERS_FILE_XFER::check_giveup(char* why) {
// Handle a transfer failure
//
void PERS_FILE_XFER::handle_xfer_failure() {
time_t now = time(0);
double now = dtime();
// If it was a bad range request, delete the file and start over
//
@ -355,15 +350,10 @@ void PERS_FILE_XFER::handle_xfer_failure() {
// backoff and try again later
//
void PERS_FILE_XFER::retry_or_backoff() {
// struct tm *newtime;
time_t now;
int backoff = 0;
double backoff = 0;
SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_FILE_XFER);
now = time(0);
// newtime = localtime(&now);
// Cycle to the next URL to try
// If we reach the URL that we started at, then we have tried all
// servers without success
@ -380,12 +370,14 @@ void PERS_FILE_XFER::retry_or_backoff() {
"pers_file_xfer",
nretry, gstate.pers_retry_delay_min, gstate.pers_retry_delay_max
);
next_request_time = now + backoff;
next_request_time = dtime() + backoff;
msg_printf(fip->project, MSG_INFO,
"Backing off %s on %s of file %s",
timediff_format(backoff).c_str(),
is_upload?"upload":"download",
fip->name
);
}
msg_printf(fip->project, MSG_INFO,
"Backing off %s on transfer of file %s",
timediff_format(backoff).c_str(), fip->name
);
}
void PERS_FILE_XFER::abort() {
@ -407,8 +399,8 @@ int PERS_FILE_XFER::parse(MIOFILE& fin) {
while (fin.fgets(buf, 256)) {
if (match_tag(buf, "</persistent_file_xfer>")) return 0;
else if (parse_int(buf, "<num_retries>", nretry)) continue;
else if (parse_int(buf, "<first_request_time>", first_request_time)) continue;
else if (parse_int(buf, "<next_request_time>", next_request_time)) continue;
else if (parse_double(buf, "<first_request_time>", first_request_time)) continue;
else if (parse_double(buf, "<next_request_time>", next_request_time)) continue;
else if (parse_double(buf, "<time_so_far>", time_so_far)) continue;
else {
msg_printf(fip->project, MSG_ERROR, "PERS_FILE_XFER::parse(): unrecognized: %s", buf);
@ -423,8 +415,8 @@ int PERS_FILE_XFER::write(MIOFILE& fout) {
fout.printf(
" <persistent_file_xfer>\n"
" <num_retries>%d</num_retries>\n"
" <first_request_time>%d</first_request_time>\n"
" <next_request_time>%d</next_request_time>\n"
" <first_request_time>%f</first_request_time>\n"
" <next_request_time>%f</next_request_time>\n"
" <time_so_far>%f</time_so_far>\n"
" </persistent_file_xfer>\n",
nretry, first_request_time, next_request_time, time_so_far

View File

@ -43,11 +43,11 @@
class PERS_FILE_XFER {
int nretry; // # of retries so far
int first_request_time; // UNIX time of first file request
double first_request_time; // time of first transfer request
bool is_upload;
public:
int next_request_time; // UNIX time to next retry the file request
double next_request_time; // UNIX time to next retry the file request
double time_so_far;
// Total time there's been an active FILE_XFER for this PFX
// Currently not used for anything; not meaningful for throughput

View File

@ -152,7 +152,7 @@ done:
// based on exponential backoff
//
int SCHEDULER_OP::set_min_rpc_time(PROJECT* p) {
int exp_backoff;
double exp_backoff;
int n = p->nrpc_failures;
if (n > gstate.retry_cap) n = gstate.retry_cap;
@ -173,7 +173,7 @@ int SCHEDULER_OP::set_min_rpc_time(PROJECT* p) {
gstate.retry_base_period
);
}
p->set_min_rpc_time(time(0) + exp_backoff);
p->set_min_rpc_time(dtime() + exp_backoff);
// note: we don't need to print a message now, it will be printed the
// next time p->waiting_until_min_rpc_time() is called.
return 0;
@ -612,7 +612,7 @@ int SCHEDULER_REPLY::parse(FILE* in, PROJECT* project) {
else if (parse_double(buf, "<host_expavg_credit>", project->host_expavg_credit)) continue;
else if (parse_str(buf, "<host_venue>", host_venue, sizeof(host_venue))) continue;
else if (parse_int(buf, "<host_create_time>", (int&)project->host_create_time)) continue;
else if (parse_int(buf, "<request_delay>", request_delay)) continue;
else if (parse_double(buf, "<request_delay>", request_delay)) continue;
else if (match_tag(buf, "<global_preferences>")) {
retval = dup_element_contents(
in,

View File

@ -86,7 +86,7 @@ struct SCHEDULER_OP {
struct SCHEDULER_REPLY {
int hostid;
int request_delay;
double request_delay;
char message[1024];
char message_priority[256];
char* global_prefs_xml;

View File

@ -39,7 +39,7 @@ SS_LOGIC::SS_LOGIC() {
// this is called when the core client receives a message
// from the screensaver module.
//
void SS_LOGIC::start_ss(time_t new_blank_time) {
void SS_LOGIC::start_ss(double new_blank_time) {
ACTIVE_TASK* atp;
if (do_ss) return;

View File

@ -43,14 +43,14 @@
#endif
class SS_LOGIC {
time_t blank_time; // 0 or time to blank screen
time_t ack_deadline; // when to give up on graphics app
double blank_time; // 0 or time to blank screen
double ack_deadline; // when to give up on graphics app
public:
SS_LOGIC();
char ss_msg[256]; // message to display on BOINC screensaver
void start_ss(time_t blank_time);
void start_ss(double blank_time);
void stop_ss();
void poll();
void reset();

View File

@ -169,7 +169,7 @@ int copy_element_contents(FILE* in, const char* end_tag, char* p, int len) {
if (strstr(buf, end_tag)) {
return 0;
}
n = strlen(buf);
n = (int)strlen(buf);
if (n >= len-1) return ERR_XML_PARSE;
strcat(p, buf);
len -= n;
@ -244,7 +244,7 @@ bool str_replace(char* str, char* substr, char* replacement) {
p = strstr(str, substr);
if (!p) return false;
int n = strlen(substr);
int n = (int)strlen(substr);
strcpy(temp, p+n);
strcpy(p, replacement);
strcat(p, temp);

View File

@ -409,7 +409,7 @@ void escape_url_readable(char *in, char* out) {
//
void canonicalize_master_url(char* url) {
char buf[1024];
int n;
size_t n;
char *p = strstr(url, "//");
if (p) {
@ -441,8 +441,9 @@ void safe_strncpy(char* dst, const char* src, int len) {
dst[len-1]=0;
}
char* time_to_string(time_t x) {
char* time_to_string(double t) {
static char buf[100];
time_t x = (time_t)t;
struct tm* tm = localtime(&x);
strftime(buf, sizeof(buf)-1, "%Y-%m-%d %H:%M:%S", tm);
return buf;
@ -455,7 +456,7 @@ static int count_debug_fake_exponential_backoff = 0;
static const int max_debug_fake_exponential_backoff = 1000; // safety limit
// return a random integer in the range [MIN,min(e^n,MAX))
int calculate_exponential_backoff(
double calculate_exponential_backoff(
const char* debug_descr, int n, double MIN, double MAX,
double factor /* = 1.0 */
) {
@ -488,11 +489,12 @@ int calculate_exponential_backoff(
return 0;
}
return (int) rand_range(MIN, rmax);
return rand_range(MIN, rmax);
}
string timediff_format(long tdiff) {
string timediff_format(double diff) {
char buf[256];
int tdiff = (int)diff;
int sex = tdiff % 60;
tdiff /= 60;

View File

@ -52,8 +52,8 @@ extern void canonicalize_master_url(char *url);
extern void safe_strncpy(char*, const char*, int);
#define safe_strcpy(x, y) safe_strncpy(x, y, sizeof(x))
#define safe_strcat(x, y) if (strlen(x)+strlen(y)<sizeof(x)) strcat(x, y)
extern char* time_to_string(time_t);
std::string timediff_format(long tdiff);
extern char* time_to_string(double);
std::string timediff_format(double);
int read_file_string(const char* pathname, std::string& result);
inline bool ends_with(std::string const& s, std::string const& suffix) {
@ -95,7 +95,7 @@ static inline double rand_range(double rmin, double rmax)
}
// return a random integer in the range [MIN,min(e^n,MAX))
int calculate_exponential_backoff(
double calculate_exponential_backoff(
const char* debug_descr, int n, double MIN, double MAX,
double factor=1.0
);

View File

@ -1295,6 +1295,9 @@
<File
RelativePath="..\lib\proxy_info.h">
</File>
<File
RelativePath="..\lib\result_state.h">
</File>
<File
RelativePath="..\client\scheduler_op.h">
</File>
@ -1348,10 +1351,10 @@
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="..\client\win\res\boinc.bmp">
RelativePath="..\client\win\boinc.bmp">
</File>
<File
RelativePath="..\client\win\boinc.bmp">
RelativePath="..\client\win\res\boinc.bmp">
</File>
<File
RelativePath="..\client\win\boinc_gui.rc">
@ -1371,10 +1374,10 @@
</FileConfiguration>
</File>
<File
RelativePath="..\client\win\boincsm.bmp">
RelativePath="..\client\win\res\boincsm.bmp">
</File>
<File
RelativePath="..\client\win\res\boincsm.bmp">
RelativePath="..\client\win\boincsm.bmp">
</File>
<File
RelativePath="..\res\CoreClient.ico">