From dcb7cfcbb79ca4a052d55cce61fff1baaccf71a9 Mon Sep 17 00:00:00 2001 From: Cecile Kim Date: Tue, 22 Oct 2002 21:44:16 +0000 Subject: [PATCH] added user_create_time, user_total_credit, user_expavgcredit, host_create_time, host_total_credit, host_expavgcredit, user country to scheduler_reply and local structs in client. svn path=/trunk/boinc/; revision=520 --- client/Makefile.in | 2 +- client/client_types.C | 40 ++++++++++++++++++++++++++++++---------- client/client_types.h | 8 ++++++-- client/cs_scheduler.C | 8 ++++++-- client/scheduler_op.C | 12 ++++++++++-- client/scheduler_op.h | 8 ++++++-- client/test_file_xfer.C | 2 +- html/user/db.inc | 2 ++ html/user/util.inc | 2 +- sched/handle_request.C | 1 + sched/server_types.C | 19 +++++++++++++++---- 11 files changed, 79 insertions(+), 25 deletions(-) diff --git a/client/Makefile.in b/client/Makefile.in index 0def85dd5d..121c968953 100644 --- a/client/Makefile.in +++ b/client/Makefile.in @@ -112,7 +112,7 @@ zip: cd $(topsrcdir)/..; zip boinc_client.zip $(ARCHIVE_TARGETS) clean: - rm -f *.o $(PROGS) core dependencies Makefile config.cache + rm -f *.o $(PROGS) core dependencies config.cache cd ../RSAEuro/source; ${MAKE} clean; cd ../lib; ${MAKE} clean; cd ../api; ${MAKE} clean; diff --git a/client/client_types.C b/client/client_types.C index 7ba801c696..16eed531b6 100644 --- a/client/client_types.C +++ b/client/client_types.C @@ -37,10 +37,14 @@ PROJECT::PROJECT() { resource_share = 0; strcpy(project_name,""); strcpy(user_name,""); - total_credit = 0; - expavg_credit = 0; + user_total_credit = 0; + user_expavg_credit = 0; + user_create_time = 0; rpc_seqno = 0; hostid = 0; + host_total_credit = 0; + host_expavg_credit = 0; + host_create_time = 0; exp_avg_cpu = 0; exp_avg_mod_time = 0; code_sign_key = NULL; @@ -104,10 +108,14 @@ int PROJECT::parse_state(FILE* in) { else if (parse_str(buf, "", master_url, sizeof(master_url))) continue; else if (parse_str(buf, "", project_name, sizeof(project_name))) continue; else if (parse_str(buf, "", user_name, sizeof(user_name))) continue; - else if (parse_double(buf, "", total_credit)) continue; - else if (parse_double(buf, "", expavg_credit)) continue; + else if (parse_double(buf, "", user_total_credit)) continue; + else if (parse_double(buf, "", user_expavg_credit)) continue; + else if (parse_int(buf, "", (int)user_create_time)) continue; else if (parse_int(buf, "", rpc_seqno)) continue; else if (parse_int(buf, "", hostid)) continue; + else if (parse_double(buf, "", host_total_credit)) continue; + else if (parse_double(buf, "", host_expavg_credit)) continue; + else if (parse_int(buf, "", (int)host_create_time)) continue; else if (parse_double(buf, "", exp_avg_cpu)) continue; else if (parse_int(buf, "", exp_avg_mod_time)) continue; else if (match_tag(buf, "")) { @@ -139,10 +147,14 @@ int PROJECT::write_state(FILE* out) { " %s\n" " %s\n" " %s\n" - " %f\n" - " %f\n" + " %f\n" + " %f\n" + " %d\n" " %d\n" " %d\n" + " %f\n" + " %f\n" + " %d\n" " %f\n" " %d\n" " %d\n" @@ -150,10 +162,14 @@ int PROJECT::write_state(FILE* out) { master_url, project_name, user_name, - total_credit, - expavg_credit, + user_total_credit, + user_expavg_credit, + user_create_time, rpc_seqno, hostid, + host_total_credit, + host_expavg_credit, + host_create_time, exp_avg_cpu, exp_avg_mod_time, nrpc_failures, @@ -176,10 +192,14 @@ void PROJECT::copy_state_fields(PROJECT& p) { scheduler_urls = p.scheduler_urls; strcpy(project_name, p.project_name); strcpy(user_name, p.user_name); - total_credit = p.total_credit; - expavg_credit = p.expavg_credit; + user_total_credit = p.user_total_credit; + user_expavg_credit = p.user_expavg_credit; + user_create_time = p.user_create_time; rpc_seqno = p.rpc_seqno; hostid = p.hostid; + host_total_credit = p.host_total_credit; + host_expavg_credit = p.host_expavg_credit; + host_create_time = p.host_create_time; exp_avg_cpu = p.exp_avg_cpu; exp_avg_mod_time = p.exp_avg_mod_time; if (p.code_sign_key) { diff --git a/client/client_types.h b/client/client_types.h index 7ac3ed82b7..2ad20927ca 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -61,10 +61,14 @@ public: vector scheduler_urls; // where to find scheduling servers char project_name[256]; // descriptive. not unique char user_name[256]; - double total_credit; // as reported by server - double expavg_credit; // as reported by server + double user_total_credit; // as reported by server + double user_expavg_credit; // as reported by server + unsigned int user_create_time; // as reported by server int rpc_seqno; int hostid; + double host_total_credit; // as reported by server + double host_expavg_credit; // as reported by server + unsigned int host_create_time; // as reported by server double exp_avg_cpu; // exponentially weighted CPU time int exp_avg_mod_time; // last time average was changed char* code_sign_key; diff --git a/client/cs_scheduler.C b/client/cs_scheduler.C index af7f15c423..21d7eea8ce 100644 --- a/client/cs_scheduler.C +++ b/client/cs_scheduler.C @@ -310,8 +310,9 @@ void CLIENT_STATE::handle_scheduler_reply( if (strlen(sr.user_name)) { strcpy(project->user_name, sr.user_name); } - project->total_credit = sr.total_credit; - project->expavg_credit = sr.expavg_credit; + project->user_total_credit = sr.user_total_credit; + project->user_expavg_credit = sr.user_expavg_credit; + project->user_create_time = sr.user_create_time; if (strlen(sr.message)) { show_message(sr.message, sr.message_priority); } @@ -322,6 +323,9 @@ void CLIENT_STATE::handle_scheduler_reply( if (sr.hostid) { project->hostid = sr.hostid; + project->host_total_credit = sr.host_total_credit; + project->host_expavg_credit = sr.host_expavg_credit; + project->host_create_time = sr.host_create_time; project->rpc_seqno = 0; } diff --git a/client/scheduler_op.C b/client/scheduler_op.C index 1b5d5b9708..c3521b5f75 100644 --- a/client/scheduler_op.C +++ b/client/scheduler_op.C @@ -406,12 +406,20 @@ int SCHEDULER_REPLY::parse(FILE* in) { continue; } else if (parse_str(buf, "", user_name, sizeof(user_name))) { continue; - } else if (parse_double(buf, "", total_credit)) { + } else if (parse_double(buf, "", user_total_credit)) { continue; - } else if (parse_double(buf, "", expavg_credit)) { + } else if (parse_double(buf, "", user_expavg_credit)) { continue; + } else if (parse_int(buf, "", (int)user_create_time)) { + continue; } else if (parse_int(buf, "", hostid)) { continue; + } else if (parse_double(buf, "", host_total_credit)) { + continue; + } else if (parse_double(buf, "", host_expavg_credit)) { + continue; + } else if (parse_int(buf, "", (int)host_create_time)) { + continue; } else if (parse_int(buf, "", request_delay)) { continue; } else if (match_tag(buf, "")) { diff --git a/client/scheduler_op.h b/client/scheduler_op.h index f64c17fac3..e0c767c374 100644 --- a/client/scheduler_op.h +++ b/client/scheduler_op.h @@ -73,6 +73,9 @@ struct SCHEDULER_OP { struct SCHEDULER_REPLY { int hostid; + double host_total_credit; + double host_expavg_credit; + unsigned int host_create_time; int request_delay; char message[1024]; char message_priority[256]; @@ -80,8 +83,9 @@ struct SCHEDULER_REPLY { char* global_prefs_xml; // not including tags char* project_prefs_xml; // not including tags char user_name[256]; - double total_credit; - double expavg_credit; + double user_total_credit; + double user_expavg_credit; + unsigned int user_create_time; vector apps; vector file_infos; vector app_versions; diff --git a/client/test_file_xfer.C b/client/test_file_xfer.C index b2686f97d3..8052fe8eaf 100644 --- a/client/test_file_xfer.C +++ b/client/test_file_xfer.C @@ -19,6 +19,7 @@ #include #include +#include #include "windows_cpp.h" #include "http.h" @@ -95,7 +96,6 @@ int main() { } } - while (1) { nxs.poll(100000, n); hos.poll(); diff --git a/html/user/db.inc b/html/user/db.inc index aee796b411..7def7d08fe 100644 --- a/html/user/db.inc +++ b/html/user/db.inc @@ -70,6 +70,8 @@ function show_host($host) { $x = $host->timezone/3600; row("Time zone: ", "UTC - $x hours"); row("Created: ", time_str($host->create_time)); + row("Total Credit:(specific to project) ", $host->total_credit); + row("Recent Averaged Credit:(credits per second) ", $host->expavg_credit); row("CPU: ", "$host->p_vendor $host->p_model"); row("Number of CPUs: ", $host->p_ncpus); row("Operating System: ", "$host->os_name $host->os_version"); diff --git a/html/user/util.inc b/html/user/util.inc index 99c6fa4e42..3d6ffd5dc5 100644 --- a/html/user/util.inc +++ b/html/user/util.inc @@ -89,7 +89,7 @@ function random_string() { } function print_country_select() { - PassThru("/disks/milkyway/a/users/anderson/boinc/tools/country_select"); + PassThru("/disks/milkyway/a/users/anderson/boinc_cvs/boinc/tools/country_select"); } function print_page_header($title) { diff --git a/sched/handle_request.C b/sched/handle_request.C index 407a13f752..84412caa29 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -489,6 +489,7 @@ void send_code_sign_key( } } + void process_request( SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, SCHED_SHMEM& ss, char* code_sign_key diff --git a/sched/server_types.C b/sched/server_types.C index 588d159047..cb0e0d381f 100644 --- a/sched/server_types.C +++ b/sched/server_types.C @@ -120,11 +120,13 @@ int SCHEDULER_REPLY::write(FILE* fout) { fprintf(fout, "%s\n" - "%f\n" - "%f\n", + "%f\n" + "%f\n" + "%d\n", user.name, user.total_credit, - user.expavg_credit + user.expavg_credit, + user.create_time ); if (request_delay) { @@ -139,7 +141,16 @@ int SCHEDULER_REPLY::write(FILE* fout) { } if (hostid) { - fprintf(fout, "%d\n", hostid); + fprintf(fout, + "%d\n" + "%f\n" + "%f\n" + "%d\n", + hostid, + host.total_credit, + host.expavg_credit, + host.create_time + ); } if (send_global_prefs) {