diff --git a/db/boinc_db.cpp b/db/boinc_db.cpp index e5a6bbaf91..4516f38439 100644 --- a/db/boinc_db.cpp +++ b/db/boinc_db.cpp @@ -316,6 +316,10 @@ void DB_APP_VERSION::db_print(char* buf){ "pfc_n=%.15e, " "pfc_avg=%.15e, " "pfc_scale=%.15e, " + "runtime_n=%.15e, " + "runtime_avg=%.15e, " + "cputime_n=%.15e, " + "cputime_avg=%.15e, " "expavg_credit=%.15e, " "expavg_time=%.15e, " "beta=%d ", @@ -331,6 +335,10 @@ void DB_APP_VERSION::db_print(char* buf){ pfc.n, pfc.avg, pfc_scale, + runtime.n, + runtime.avg, + cputime.n, + cputime.avg, expavg_credit, expavg_time, beta @@ -353,6 +361,10 @@ void DB_APP_VERSION::db_parse(MYSQL_ROW &r) { pfc.n = atof(r[i++]); pfc.avg = atof(r[i++]); pfc_scale = atof(r[i++]); + runtime.n = atof(r[i++]); + runtime.avg = atof(r[i++]); + cputime.n = atof(r[i++]); + cputime.avg = atof(r[i++]); expavg_credit = atof(r[i++]); expavg_time = atof(r[i++]); beta = atoi(r[i++]); @@ -1428,6 +1440,10 @@ int DB_HOST_APP_VERSION::update_validator(DB_HOST_APP_VERSION& orig) { && et.avg == orig.et.avg && et.q == orig.et.q && et.var == orig.et.var + && runtime.n == orig.runtime.n + && runtime.avg == orig.runtime.avg + && cputime.n == orig.cputime.n + && cputime.avg == orig.cputime.avg && turnaround.n == orig.turnaround.n && turnaround.avg == orig.turnaround.avg && turnaround.q == orig.turnaround.q @@ -1444,6 +1460,10 @@ int DB_HOST_APP_VERSION::update_validator(DB_HOST_APP_VERSION& orig) { "et_avg=%.15e, " "et_q=%.15e, " "et_var=%.15e, " + "runtime_n=%.15e, " + "runtime_avg=%.15e, " + "cputime_n=%.15e, " + "cputime_avg=%.15e, " "turnaround_n=%.15e, " "turnaround_avg=%.15e, " "turnaround_q=%.15e, " @@ -1456,6 +1476,10 @@ int DB_HOST_APP_VERSION::update_validator(DB_HOST_APP_VERSION& orig) { et.avg, et.q, et.var, + runtime.n, + runtime.avg, + cputime.n, + cputime.avg, turnaround.n, turnaround.avg, turnaround.q, @@ -1480,6 +1504,10 @@ void DB_HOST_APP_VERSION::db_print(char* buf) { "et_avg=%.15e, " "et_var=%.15e, " "et_q=%.15e, " + "runtime_n=%.15e, " + "runtime_avg=%.15e, " + "cputime_n=%.15e, " + "cputime_avg=%.15e, " "max_jobs_per_day=%d, " "n_jobs_today=%d, " "turnaround_n=%.15e, " @@ -1495,6 +1523,10 @@ void DB_HOST_APP_VERSION::db_print(char* buf) { et.avg, et.var, et.q, + runtime.n, + runtime.avg, + cputime.n, + cputime.avg, max_jobs_per_day, n_jobs_today, turnaround.n, @@ -1516,6 +1548,10 @@ void DB_HOST_APP_VERSION::db_parse(MYSQL_ROW& r) { et.avg = atof(r[i++]); et.var = atof(r[i++]); et.q = atof(r[i++]); + runtime.n = atof(r[i++]); + runtime.avg = atof(r[i++]); + cputime.n = atof(r[i++]); + cputime.avg = atof(r[i++]); max_jobs_per_day = atoi(r[i++]); n_jobs_today = atoi(r[i++]); turnaround.n = atof(r[i++]); diff --git a/db/boinc_db_types.h b/db/boinc_db_types.h index e724f1056c..b548193bd6 100644 --- a/db/boinc_db_types.h +++ b/db/boinc_db_types.h @@ -142,6 +142,8 @@ struct APP_VERSION { // PFC scaling factor for this app (or 0 if not enough data) // The reciprocal of this version's efficiency, averaged over all jobs, // relative to that of the most efficient version + AVERAGE runtime; + AVERAGE cputime; double expavg_credit; double expavg_time; bool beta; @@ -739,6 +741,8 @@ struct HOST_APP_VERSION { // // for old clients (which don't report elapsed time) // we use this for CPU time stats + AVERAGE runtime; + AVERAGE cputime; int max_jobs_per_day; // the actual limit is: // for GPU versions: diff --git a/db/schema.sql b/db/schema.sql index a3d4daea31..47502b5d14 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -87,6 +87,10 @@ create table app_version ( pfc_n double not null default 0, pfc_avg double not null default 0, pfc_scale double not null default 0, + runtime_n double not null default 0, + runtime_avg double not null default 0, + cputime_n double not null default 0, + cputime_avg double not null default 0, expavg_credit double not null default 0, expavg_time double not null default 0, beta tinyint not null default 0, @@ -229,6 +233,10 @@ create table host_app_version ( et_avg double not null, et_var double not null, et_q double not null, + runtime_n double not null, + runtime_avg double not null, + cputime_n double not null, + cputime_avg double not null, max_jobs_per_day integer not null, n_jobs_today integer not null, turnaround_n double not null, diff --git a/html/ops/db_update.php b/html/ops/db_update.php index 8bf58e9189..594905700a 100644 --- a/html/ops/db_update.php +++ b/html/ops/db_update.php @@ -1230,6 +1230,22 @@ function update_9_12_2018() { "); } +// Add fields needed for computing runtime stats +function update_10_30_2019() { + do_query("alter table app_version + add runtime_n double not null default 0 after pfc_scale, + add runtime_avg double not null default 0 after runtime_n, + add cputime_n double not null default 0 after runtime_avg, + add cputime_avg double not null default 0 after cputime_n + "); + do_query("alter table host_app_version + add runtime_n double not null default 0 after et_q, + add runtime_avg double not null default 0 after runtime_n, + add cputime_n double not null default 0 after runtime_avg, + add cputime_avg double not null default 0 after cputime_n + "); +} + // Updates are done automatically if you use "upgrade". // // If you need to do updates manually, @@ -1289,7 +1305,8 @@ function update_9_12_2018() { array(27025, "update_4_19_2018"), array(27026, "update_5_9_2018"), array(27027, "update_8_23_2018"), - array(27028, "update_9_12_2018") + array(27028, "update_9_12_2018"), + array(27029, "update_10_30_2019") ); ?> diff --git a/html/user/apps.php b/html/user/apps.php index 10d0310932..0b2dd02dc1 100644 --- a/html/user/apps.php +++ b/html/user/apps.php @@ -50,12 +50,14 @@ } else { $b = $app->beta?" (beta test)":""; echo " - $app->user_friendly_name$b + $app->user_friendly_name$b ".tra("Platform")." ".tra("Version")." ".tra("Created")." - ".tra("Average computing")." + ".tra("Avg Run Time")." + ".tra("Avg CPU Time")." + ".tra("Average computing")." "; } @@ -84,10 +86,23 @@ $total_gf += $gf; $gf = number_format($gf, 0); $b = $av->beta?" (beta test)":""; + $runtime_avg="NA"; + $cputime_avg="NA"; + if ($av->runtime_avg>0) { + $runtime_avg = number_format($av->runtime_avg/3600, 2); + $runtime_avg .= " hrs/task"; + } + if ($av->cputime_avg>0) { + $cputime_avg = number_format($av->cputime_avg/3600, 2); + $cputime_avg .= " hrs/task"; + } + echo " $platform->user_friendly_name $version_num_f$b $create_time_f + $runtime_avg + $cputime_avg $gf GigaFLOPS "; diff --git a/sched/credit.cpp b/sched/credit.cpp index 8ae4ba20d7..bbc5102b13 100644 --- a/sched/credit.cpp +++ b/sched/credit.cpp @@ -563,6 +563,23 @@ int get_pfc( return 0; } + // get app version + // + avp = av_lookup(r.app_version_id, app_versions); + + // Update runtime and cputime stats. + // this is here because this is where it used to be. It should probably be + // elsewhere since it's really not pfc related. + if (avp && !r.runtime_outlier) { + if (r.elapsed_time > 0) { + avp->runtime.update(r.elapsed_time,AV_AVG_THRESH,AV_AVG_WEIGHT,AV_AVG_LIMIT); + hav.runtime.update(r.elapsed_time,HAV_AVG_THRESH,HAV_AVG_WEIGHT,HAV_AVG_LIMIT); + } + if (r.cpu_time > 0) { + avp->cputime.update(r.cpu_time,HAV_AVG_THRESH,HAV_AVG_WEIGHT,HAV_AVG_LIMIT); + hav.cputime.update(r.cpu_time,HAV_AVG_THRESH,HAV_AVG_WEIGHT,HAV_AVG_LIMIT); + } + } // old clients report CPU time but not elapsed time. // Use HOST_APP_VERSION.et to track statistics of CPU time. // @@ -575,16 +592,15 @@ int get_pfc( r.id ); } + if (!r.runtime_outlier) { hav.et.update_var( r.cpu_time/wu.rsc_fpops_est, HAV_AVG_THRESH, HAV_AVG_WEIGHT, HAV_AVG_LIMIT ); -// if ((r.elapsed_time > 0) && (r.cpu_time > 0)) { -// hav.rt.update(r.elapsed_time,HAV_AVG_THRESH,HAV_AVG_WEIGHT,HAV_AVG_LIMIT); -// hav.cpu.update(r.cpu_time,HAV_AVG_THRESH,HAV_AVG_WEIGHT,HAV_AVG_LIMIT); -// } } + + pfc = wu_estimated_pfc(wu, app); if (config.debug_credit) { log_messages.printf(MSG_NORMAL, @@ -650,9 +666,6 @@ int get_pfc( ); } - // get app version - // - avp = av_lookup(r.app_version_id, app_versions); // Sanity check // If an app version scale exists, use it. Otherwise assume 1. @@ -1076,9 +1089,20 @@ int write_modified_app_versions(vector& app_versions) { } char query[512], clause[512]; sprintf(query, - "pfc_n=%.15e, pfc_avg=%.15e, expavg_credit=%.15e, expavg_time=%f", + "pfc_n=%.15e, " + "pfc_avg=%.15e, " + "runtime_n=%.15e, " + "runtime_avg=%.15e, " + "cputime_n=%.15e, " + "cputime_avg=%.15e, " + "expavg_credit=%.15e, " + "expavg_time=%f ", av.pfc.n, av.pfc.avg, + av.runtime.n, + av.runtime.avg, + av.cputime.n, + av.cputime.avg, av.expavg_credit, av.expavg_time );