From 6ebb7207aa28798c9786882c2065164352316efd Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 29 Mar 2007 16:40:43 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=12280 --- checkin_notes | 13 +++ client/cpu_sched.C | 2 +- client/file_xfer.h | 4 - client/log_flags.C | 1 - client/log_flags.h | 4 + client/sim.C | 143 +++++++++++++++++++++++++++++---- client/sim.h | 2 + lib/browser.C | 4 + win_build/boincmgr_curl.vcproj | 8 -- win_build/sim.vcproj | 8 +- 10 files changed, 154 insertions(+), 35 deletions(-) diff --git a/checkin_notes b/checkin_notes index cc2676c705..98e605a03d 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2909,3 +2909,16 @@ David 28 Mar 2007 html/inc/ prefs.inc + +David 29 Mar 2007 + - core client: fix some debug messages + - more code-shuffling for client simulator + + client/ + cpu_sched.C + file_xfer.h + log_flags.C,h + sim.C,h + win_build/ + boincmgr_curl.vcproj + sim.vcproj diff --git a/client/cpu_sched.C b/client/cpu_sched.C index d9212d91d6..f3f76c6fe9 100644 --- a/client/cpu_sched.C +++ b/client/cpu_sched.C @@ -1229,7 +1229,7 @@ void CLIENT_STATE::rr_simulation() { } } msg_printf(NULL, MSG_INFO, - "rr_simulation: end; total shortfall %f\n", + "[rr_sim] done; total shortfall %f\n", cpu_shortfall ); } diff --git a/client/file_xfer.h b/client/file_xfer.h index 5fe0bee1b2..39fc7a5e4a 100644 --- a/client/file_xfer.h +++ b/client/file_xfer.h @@ -28,10 +28,6 @@ #include "client_types.h" #include "http_curl.h" -#define MAX_FILE_XFERS_PER_PROJECT 2 -#define MAX_FILE_XFERS 8 - // kind of arbitrary - #define MIN_DOWNLOAD_INCREMENT 5000 class FILE_XFER : public HTTP_OP { diff --git a/client/log_flags.C b/client/log_flags.C index 7f1bdfef6c..7a2392e5a4 100644 --- a/client/log_flags.C +++ b/client/log_flags.C @@ -33,7 +33,6 @@ #include "common_defs.h" #include "file_names.h" #include "client_msgs.h" -#include "file_xfer.h" #include "parse.h" #include "filesys.h" diff --git a/client/log_flags.h b/client/log_flags.h index a26b0f1dfb..011708c0df 100644 --- a/client/log_flags.h +++ b/client/log_flags.h @@ -30,6 +30,10 @@ #include #endif +#define MAX_FILE_XFERS_PER_PROJECT 2 +#define MAX_FILE_XFERS 8 + // kind of arbitrary + class XML_PARSER; struct LOG_FLAGS { diff --git a/client/sim.C b/client/sim.C index f934869687..e970651af5 100644 --- a/client/sim.C +++ b/client/sim.C @@ -69,6 +69,92 @@ HOST_INFO::HOST_INFO() {} //////////////// FUNCTIONS COPIED ///////////// +void PROJECT::init() { + strcpy(master_url, ""); + strcpy(authenticator, ""); + project_specific_prefs = ""; + gui_urls = ""; + resource_share = 100; + strcpy(host_venue, ""); + using_venue_specific_prefs = false; + scheduler_urls.clear(); + strcpy(project_name, ""); + strcpy(symstore, ""); + strcpy(user_name, ""); + strcpy(team_name, ""); + strcpy(email_hash, ""); + strcpy(cross_project_id, ""); + user_total_credit = 0; + user_expavg_credit = 0; + user_create_time = 0; + ams_resource_share = 0; + rpc_seqno = 0; + hostid = 0; + host_total_credit = 0; + host_expavg_credit = 0; + host_create_time = 0; + nrpc_failures = 0; + master_fetch_failures = 0; + min_rpc_time = 0; + possibly_backed_off = true; + master_url_fetch_pending = false; + sched_rpc_pending = 0; + next_rpc_time = 0; + last_rpc_time = 0; + trickle_up_pending = false; + tentative = false; + anonymous_platform = false; + non_cpu_intensive = false; + verify_files_on_app_start = false; + short_term_debt = 0; + long_term_debt = 0; + send_file_list = false; + suspended_via_gui = false; + dont_request_more_work = false; + detach_when_done = false; + attached_via_acct_mgr = false; + strcpy(code_sign_key, ""); + user_files.clear(); + project_files.clear(); + anticipated_debt = 0; + wall_cpu_time_this_debt_interval = 0; + next_runnable_result = NULL; + work_request = 0; + work_request_urgency = WORK_FETCH_DONT_NEED; + duration_correction_factor = 1; + project_files_downloaded_time = 0; + + // Initialize scratch variables. + rrsim_proc_rate = 0.0; + cpu_shortfall = 0.0; + rr_sim_deadlines_missed = 0; + deadlines_missed = 0; +} + +void RESULT::clear() { + strcpy(name, ""); + strcpy(wu_name, ""); + report_deadline = 0; + output_files.clear(); + _state = RESULT_NEW; + ready_to_report = false; + completed_time = 0; + got_server_ack = false; + final_cpu_time = 0; + exit_status = 0; + stderr_out = ""; + suspended_via_gui = false; + rr_sim_misses_deadline = false; + last_rr_sim_missed_deadline = false; + fpops_per_cpu_sec = 0; + fpops_cumulative = 0; + intops_per_cpu_sec = 0; + intops_cumulative = 0; + app = NULL; + wup = NULL; + project = NULL; +} + static const char* task_state_name(int val) { switch (val) { case PROCESS_UNINITIALIZED: return "UNINITIALIZED"; @@ -151,17 +237,32 @@ RESULT* CLIENT_STATE::lookup_result(PROJECT* p, const char* name) { } void CLIENT_STATE::simulate_rpc(PROJECT* p) { - static int i=0; - RESULT* rp = new RESULT; - WORKUNIT* wup = new WORKUNIT; - rp->project = p; - rp->wup = wup; - sprintf(rp->name, "result_%d", i++); - rp->set_state(RESULT_FILES_DOWNLOADED, "simulate_rpc"); - wup->project = p; - wup->rsc_fpops_est = 10000000; - wup->rsc_fpops_bound = 10000000; - results.push_back(rp); + unsigned int i; + double net_fpops = host_info.p_fpops; + while (1) { + // pick a random app + SIM_APP* ap; + double x = drand(); + for (i=0; iproject != p) continue; + x -= ap->weight; + if (x <= 0) break; + } + RESULT* rp = new RESULT; + WORKUNIT* wup = new WORKUNIT; + rp->clear(); + rp->project = p; + rp->wup = wup; + sprintf(rp->name, "result_%d", i++); + rp->set_state(RESULT_FILES_DOWNLOADED, "simulate_rpc"); + wup->project = p; + wup->rsc_fpops_est = ap->fpops.sample(); + results.push_back(rp); + double est_cpu = ap->fpops_est/net_fpops; + p->work_request -= est_cpu; + if (p->work_request <= 0) break; + } request_schedule_cpus("simulate_rpc"); } @@ -238,13 +339,18 @@ int ACTIVE_TASK::init(RESULT* rp) { max_disk_usage = rp->wup->rsc_disk_bound; max_mem_usage = rp->wup->rsc_memory_bound; cpu_time_left = 100; + _task_state = PROCESS_UNINITIALIZED; + scheduler_state = CPU_SCHED_UNINITIALIZED; return 0; } //////////////// OTHER PROJECT::PROJECT() { - duration_correction_factor = 1; +} + +double NORMAL_DIST::sample() { + return 1; } int NORMAL_DIST::parse(XML_PARSER& xp, char* end_tag) { @@ -295,7 +401,9 @@ int SIM_APP::parse(XML_PARSER& xp) { if (!is_tag) return ERR_XML_PARSE; if (!strcmp(tag, "/app")) { return 0; - } else if (xp.parse_double(tag, "latency_bound", latency_bound)) continue; + } + else if (xp.parse_double(tag, "latency_bound", latency_bound)) continue; + else if (xp.parse_double(tag, "fpops_est", fpops_est)) continue; else if (!strcmp(tag, "fpops")) { retval = fpops.parse(xp, "/fpops"); if (retval) return retval; @@ -370,6 +478,7 @@ int CLIENT_STATE::parse_projects(char* name) { if (!is_tag) return ERR_XML_PARSE; if (!strcmp(tag, "project")) { SIM_PROJECT *p = new SIM_PROJECT; + p->init(); retval = p->parse(xp); if (retval) return retval; projects.push_back(p); @@ -418,11 +527,11 @@ int main(int argc, char** argv) { char projects[256], host[256], prefs[256]; double duration = 100; bool flag; - int retval; + int retval; - strcpy(projects, "projects.xml"); - strcpy(host, "host.xml"); - strcpy(prefs, "prefs.xml"); + strcpy(projects, "sim_projects.xml"); + strcpy(host, "sim_host.xml"); + strcpy(prefs, "sim_prefs.xml"); read_config_file(); diff --git a/client/sim.h b/client/sim.h index 8bab284dc3..0adb3967d6 100644 --- a/client/sim.h +++ b/client/sim.h @@ -46,9 +46,11 @@ public: class SIM_APP: public APP { public: double latency_bound; + double fpops_est; NORMAL_DIST fpops; NORMAL_DIST checkpoint_period; double working_set; + double weight; int parse(XML_PARSER&); }; diff --git a/lib/browser.C b/lib/browser.C index de52b58e3e..d44664f9d7 100644 --- a/lib/browser.C +++ b/lib/browser.C @@ -57,6 +57,7 @@ bool detect_setup_authenticator_firefox( return false; } + #ifdef _WIN32 // // Detect the 'Setup' cookie in Internet Explorer by using the InternetGetCookie API. @@ -65,6 +66,7 @@ bool detect_setup_authenticator_firefox( // bool detect_setup_authenticator_ie(std::string& project_url, std::string& authenticator) { +#if 0 bool bReturnValue = FALSE; BOOL bValidates = TRUE; char szCookieBuffer[2048]; @@ -125,5 +127,7 @@ bool detect_setup_authenticator_ie(std::string& project_url, std::string& authen } return bReturnValue; +#endif + return false; } #endif diff --git a/win_build/boincmgr_curl.vcproj b/win_build/boincmgr_curl.vcproj index 3378f2191c..24296021e0 100644 --- a/win_build/boincmgr_curl.vcproj +++ b/win_build/boincmgr_curl.vcproj @@ -664,14 +664,6 @@ RelativePath="..\lib\browser.h" > - - - - diff --git a/win_build/sim.vcproj b/win_build/sim.vcproj index 5490e11189..686d9cd6f8 100644 --- a/win_build/sim.vcproj +++ b/win_build/sim.vcproj @@ -48,7 +48,7 @@