2009-11-10 21:00:29 +00:00
|
|
|
// credit_test [--app N]
|
|
|
|
//
|
|
|
|
// Simulate the new credit system for the N most recent jobs
|
|
|
|
// in project's database, and give a comparison of new and old systems.
|
|
|
|
// Doesn't modify anything.
|
|
|
|
//
|
|
|
|
// --app N: restrict to jobs from app with ID N
|
|
|
|
|
2009-11-04 21:23:56 +00:00
|
|
|
#include <stdio.h>
|
2009-11-04 23:04:07 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2009-11-04 21:23:56 +00:00
|
|
|
#include "sched_config.h"
|
|
|
|
#include "boinc_db.h"
|
|
|
|
|
2009-11-10 21:00:29 +00:00
|
|
|
#define NJOBS 50000
|
|
|
|
// scan this many jobs
|
|
|
|
#define MAX_CLAIMED_CREDIT 1e3
|
|
|
|
// Ignore jobs whose claimed (old) credit is greater than this.
|
|
|
|
// Rejects jobs with garbage values.
|
|
|
|
#define MIN_CLAIMED_CREDIT 50.0
|
|
|
|
// Ignore jobs whose claimed (old) credit is less than this.
|
|
|
|
// Small jobs are noisy.
|
|
|
|
#define COBBLESTONE_SCALE 100/86400e9
|
|
|
|
// FLOPS to cobblestones
|
2009-11-12 00:22:33 +00:00
|
|
|
#define PRINT_AV_PERIOD 100
|
|
|
|
#define SCALE_AV_PERIOD 20
|
|
|
|
#define MIN_HOST_SCALE_SAMPLES 5
|
|
|
|
// don't use host scaling unless have this many samples for host
|
2009-11-12 00:40:30 +00:00
|
|
|
#define MIN_SCALE_SAMPLES 100
|
|
|
|
// don't update a version's scale unless it has this many samples
|
2009-11-10 21:00:29 +00:00
|
|
|
|
|
|
|
#define RSC_TYPE_CPU -1
|
|
|
|
#define RSC_TYPE_CUDA -2
|
|
|
|
#define RSC_TYPE_ATI -3
|
|
|
|
|
|
|
|
// guess (by looking at stderr_out) which type of app processed this job.
|
|
|
|
// This is needed for jobs from pre-6.10 clients,
|
|
|
|
// where the client doesn't report this.
|
|
|
|
// THIS IS PROJECT-SPECIFIC: YOU'LL NEED TO EDIT THIS
|
|
|
|
//
|
|
|
|
int get_rsc_type(RESULT& r) {
|
|
|
|
if (strstr(r.stderr_out, "CUDA")) return RSC_TYPE_CUDA;
|
|
|
|
if (strstr(r.stderr_out, "ATI")) return RSC_TYPE_ATI;
|
|
|
|
return RSC_TYPE_CPU;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const char* rsc_type_name(int t) {
|
|
|
|
switch (t) {
|
|
|
|
case RSC_TYPE_CPU: return "CPU";
|
|
|
|
case RSC_TYPE_CUDA: return "NVIDIA";
|
|
|
|
case RSC_TYPE_ATI: return "ATI";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-04 21:23:56 +00:00
|
|
|
struct HOST_APP_VERSION {
|
|
|
|
int host_id;
|
2009-11-12 00:22:33 +00:00
|
|
|
int app_version_id; // -1 means anon platform
|
|
|
|
AVERAGE vnpfc;
|
2009-11-04 21:23:56 +00:00
|
|
|
AVERAGE et;
|
|
|
|
};
|
|
|
|
|
|
|
|
vector<APP_VERSION> app_versions;
|
|
|
|
vector<APP> apps;
|
|
|
|
vector<HOST_APP_VERSION> host_app_versions;
|
2009-11-10 21:00:29 +00:00
|
|
|
vector<PLATFORM> platforms;
|
|
|
|
int windows_platformid;
|
2009-11-12 00:40:30 +00:00
|
|
|
int linux_platformid;
|
|
|
|
int mac_platformid;
|
2009-11-10 21:00:29 +00:00
|
|
|
bool accumulate_stats = false;
|
2009-11-04 21:23:56 +00:00
|
|
|
|
|
|
|
void read_db() {
|
|
|
|
DB_APP app;
|
|
|
|
DB_APP_VERSION av;
|
|
|
|
|
|
|
|
while (!app.enumerate("where deprecated=0")) {
|
|
|
|
app.vnpfc.clear();
|
|
|
|
apps.push_back(app);
|
|
|
|
}
|
2009-11-10 21:00:29 +00:00
|
|
|
while (!av.enumerate("where deprecated=0 order by id desc")) {
|
2009-11-04 21:23:56 +00:00
|
|
|
av.pfc.clear();
|
|
|
|
av.pfc_scale_factor = 1;
|
2009-11-12 00:40:30 +00:00
|
|
|
//if (strstr(av.plan_class, "cuda")) {
|
|
|
|
// av.pfc_scale_factor = 0.15;
|
|
|
|
//}
|
2009-11-04 21:23:56 +00:00
|
|
|
app_versions.push_back(av);
|
|
|
|
}
|
2009-11-10 21:00:29 +00:00
|
|
|
DB_PLATFORM platform;
|
|
|
|
while (!platform.enumerate("")) {
|
|
|
|
platforms.push_back(platform);
|
|
|
|
if (!strcmp(platform.name, "windows_intelx86")) {
|
|
|
|
windows_platformid = platform.id;
|
|
|
|
}
|
2009-11-12 00:40:30 +00:00
|
|
|
if (!strcmp(platform.name, "i686-pc-linux-gnu")) {
|
|
|
|
linux_platformid = platform.id;
|
|
|
|
}
|
|
|
|
if (!strcmp(platform.name, "i686-apple-darwin")) {
|
|
|
|
mac_platformid = platform.id;
|
|
|
|
}
|
2009-11-10 21:00:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PLATFORM* lookup_platform(int id) {
|
|
|
|
unsigned int i;
|
|
|
|
for (i=0; i<platforms.size(); i++) {
|
|
|
|
PLATFORM& p = platforms[i];
|
|
|
|
if (p.id == id) return &p;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
APP_VERSION* lookup_av(int id) {
|
|
|
|
unsigned int i;
|
|
|
|
for (i=0; i<app_versions.size(); i++) {
|
|
|
|
APP_VERSION& av = app_versions[i];
|
|
|
|
if (av.id == id) return &av;
|
|
|
|
}
|
|
|
|
printf(" missing app version %d\n", id);
|
|
|
|
exit(1);
|
2009-11-04 21:23:56 +00:00
|
|
|
}
|
|
|
|
|
2009-11-12 00:40:30 +00:00
|
|
|
|
|
|
|
APP_VERSION* lookup_av_old(int appid, HOST& host) {
|
|
|
|
unsigned int i;
|
|
|
|
for (i=0; i<app_versions.size(); i++) {
|
|
|
|
APP_VERSION& av = app_versions[i];
|
|
|
|
if (av.appid != appid) continue;
|
|
|
|
if (av.platformid == windows_platformid && strstr(host.os_name, "Microsoft") != NULL ) return &av;
|
|
|
|
if (av.platformid == mac_platformid && strstr(host.os_name, "Darwin") != NULL ) return &av;
|
|
|
|
if (av.platformid == linux_platformid && strstr(host.os_name, "Linux") != NULL ) return &av;
|
|
|
|
}
|
|
|
|
printf(" missing app version app %d type %s\n", appid, host.os_name);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-10 21:00:29 +00:00
|
|
|
APP_VERSION* lookup_av_anon(int appid, int rsc_type) {
|
2009-11-04 21:23:56 +00:00
|
|
|
unsigned int i;
|
|
|
|
for (i=0; i<app_versions.size(); i++) {
|
|
|
|
APP_VERSION& av = app_versions[i];
|
2009-11-10 21:00:29 +00:00
|
|
|
if (av.appid != appid) continue;
|
|
|
|
if (av.platformid != windows_platformid) continue;
|
|
|
|
switch(rsc_type) {
|
|
|
|
case RSC_TYPE_CPU:
|
|
|
|
if (strlen(av.plan_class)) continue;
|
|
|
|
break;
|
|
|
|
case RSC_TYPE_CUDA:
|
|
|
|
if (strcmp(av.plan_class, "cuda")) continue;
|
|
|
|
break;
|
|
|
|
case RSC_TYPE_ATI:
|
|
|
|
if (strcmp(av.plan_class, "ati")) continue;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return &av;
|
2009-11-04 21:23:56 +00:00
|
|
|
}
|
2009-11-10 21:00:29 +00:00
|
|
|
printf(" missing app version app %d type %d\n", appid, rsc_type);
|
|
|
|
return 0;
|
2009-11-04 21:23:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
APP& lookup_app(int id) {
|
|
|
|
unsigned int i;
|
|
|
|
for (i=0; i<apps.size(); i++) {
|
|
|
|
APP& app = apps[i];
|
|
|
|
if (app.id == id) return app;
|
|
|
|
}
|
|
|
|
printf("missing app%d\n", id);
|
|
|
|
}
|
|
|
|
|
2009-11-12 00:22:33 +00:00
|
|
|
HOST_APP_VERSION& lookup_host_app_version(int hostid, int avid) {
|
2009-11-04 21:23:56 +00:00
|
|
|
unsigned int i;
|
2009-11-12 00:22:33 +00:00
|
|
|
for (i=0; i<host_app_versions.size(); i++) {
|
|
|
|
HOST_APP_VERSION& hav = host_app_versions[i];
|
|
|
|
if (hav.host_id != hostid) continue;
|
|
|
|
if (hav.app_version_id != avid) continue;
|
|
|
|
return hav;
|
2009-11-04 21:23:56 +00:00
|
|
|
}
|
2009-11-12 00:22:33 +00:00
|
|
|
HOST_APP_VERSION h;
|
2009-11-04 21:23:56 +00:00
|
|
|
h.host_id = hostid;
|
2009-11-12 00:22:33 +00:00
|
|
|
h.app_version_id = avid;
|
2009-11-04 21:23:56 +00:00
|
|
|
h.vnpfc.clear();
|
2009-11-12 00:22:33 +00:00
|
|
|
host_app_versions.push_back(h);
|
|
|
|
return host_app_versions.back();
|
2009-11-04 21:23:56 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 23:04:07 +00:00
|
|
|
void print_average(AVERAGE& a) {
|
2009-11-10 21:00:29 +00:00
|
|
|
printf("n %.0f avg PFC %.0fG avg raw credit %.2f",
|
|
|
|
a.n, a.get_mean()/1e9, a.get_mean()*COBBLESTONE_SCALE
|
|
|
|
);
|
2009-11-04 23:04:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void print_avs() {
|
|
|
|
unsigned int i;
|
2009-11-10 21:00:29 +00:00
|
|
|
printf("----- scales --------\n");
|
2009-11-04 23:04:07 +00:00
|
|
|
for (i=0; i<app_versions.size(); i++) {
|
|
|
|
APP_VERSION& av = app_versions[i];
|
|
|
|
if (!av.pfc.n) continue;
|
2009-11-10 21:00:29 +00:00
|
|
|
PLATFORM* p = lookup_platform(av.platformid);
|
|
|
|
printf("app %d vers %d (%s %s)\n scale %f ",
|
|
|
|
av.appid, av.id, p->name, av.plan_class, av.pfc_scale_factor
|
2009-11-04 23:04:07 +00:00
|
|
|
);
|
|
|
|
print_average(av.pfc);
|
|
|
|
printf("\n");
|
|
|
|
}
|
2009-11-10 21:00:29 +00:00
|
|
|
printf("-------------\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void lookup_host(DB_HOST& h, int id) {
|
|
|
|
int retval = h.lookup_id(id);
|
|
|
|
if (retval) {
|
|
|
|
printf("can't find host %d\n", id);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// update app version scale factors
|
|
|
|
//
|
|
|
|
void update_av_scales() {
|
|
|
|
unsigned int i, j;
|
|
|
|
printf("----- updating scales --------\n");
|
|
|
|
for (i=0; i<apps.size(); i++) {
|
|
|
|
APP& app = apps[i];
|
|
|
|
int n=0;
|
|
|
|
|
|
|
|
// find the average PFC of CPU versions
|
|
|
|
|
|
|
|
double sum_avg = 0;
|
|
|
|
double sum_n = 0;
|
|
|
|
for (j=0; j<app_versions.size(); j++) {
|
|
|
|
APP_VERSION& av = app_versions[j];
|
|
|
|
if (av.appid != app.id) continue;
|
2009-11-12 00:40:30 +00:00
|
|
|
if (av.pfc.n < MIN_SCALE_SAMPLES) continue;
|
2009-11-10 21:00:29 +00:00
|
|
|
if (strstr(av.plan_class, "cuda")) continue;
|
|
|
|
if (strstr(av.plan_class, "ati")) continue;
|
|
|
|
sum_avg += av.pfc.get_mean() * av.pfc.n;
|
|
|
|
sum_n += av.pfc.n;
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
if (n < 1) continue;
|
|
|
|
double cpu_avg = sum_avg / sum_n;
|
|
|
|
printf("cpu avg is %0.fG\n", cpu_avg/1e9);
|
|
|
|
|
2009-11-12 00:40:30 +00:00
|
|
|
// if at least 2 versions have at least MIN_SCALE_SAMPLES samples,
|
2009-11-10 21:00:29 +00:00
|
|
|
// update their scale factors
|
|
|
|
//
|
|
|
|
for (j=0; j<app_versions.size(); j++) {
|
|
|
|
APP_VERSION& av = app_versions[j];
|
|
|
|
if (av.appid != app.id) continue;
|
2009-11-12 00:40:30 +00:00
|
|
|
if (av.pfc.n < MIN_SCALE_SAMPLES) continue;
|
2009-11-10 21:00:29 +00:00
|
|
|
av.pfc_scale_factor = cpu_avg/av.pfc.get_mean();
|
|
|
|
PLATFORM* p = lookup_platform(av.platformid);
|
|
|
|
printf("updating scale factor for (%s %s)\n",
|
|
|
|
p->name, av.plan_class
|
|
|
|
);
|
|
|
|
printf(" n: %0.f avg PFC: %0.fG new scale: %f\n",
|
|
|
|
av.pfc.n, av.pfc.get_mean()/1e9, av.pfc_scale_factor
|
|
|
|
);
|
|
|
|
}
|
|
|
|
accumulate_stats = true;
|
|
|
|
}
|
|
|
|
printf("-------------\n");
|
2009-11-04 23:04:07 +00:00
|
|
|
}
|
|
|
|
|
2009-11-10 21:00:29 +00:00
|
|
|
int main(int argc, char** argv) {
|
2009-11-04 21:23:56 +00:00
|
|
|
DB_RESULT r;
|
2009-11-10 21:00:29 +00:00
|
|
|
char clause[256], subclause[256];
|
2009-11-04 21:23:56 +00:00
|
|
|
int retval;
|
2009-11-10 21:00:29 +00:00
|
|
|
int appid=0;
|
|
|
|
|
|
|
|
if (argc >= 3 && !strcmp(argv[1], "--app")) {
|
|
|
|
appid = atoi(argv[2]);
|
|
|
|
}
|
2009-11-04 21:23:56 +00:00
|
|
|
|
|
|
|
retval = config.parse_file();
|
|
|
|
if (retval) {printf("no config: %d\n", retval); exit(1);}
|
2009-11-10 21:03:50 +00:00
|
|
|
//strcpy(config.db_host, "jocelyn");
|
2009-11-04 21:23:56 +00:00
|
|
|
retval = boinc_db.open(
|
|
|
|
config.db_name, config.db_host, config.db_user, config.db_passwd
|
|
|
|
);
|
|
|
|
if (retval) {printf("no db\n"); exit(1);}
|
|
|
|
|
|
|
|
read_db();
|
|
|
|
|
2009-11-10 21:00:29 +00:00
|
|
|
strcpy(subclause, "");
|
|
|
|
if (appid) {
|
|
|
|
sprintf(subclause, "and appid=%d", appid);
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(clause,
|
2009-11-12 00:40:30 +00:00
|
|
|
"where server_state=%d and outcome=%d and validate_state=%d and claimed_credit<%f and claimed_credit>%f %s order by id desc limit %d",
|
2009-11-10 21:00:29 +00:00
|
|
|
RESULT_SERVER_STATE_OVER, RESULT_OUTCOME_SUCCESS,
|
2009-11-12 00:40:30 +00:00
|
|
|
VALIDATE_STATE_VALID,
|
2009-11-10 21:00:29 +00:00
|
|
|
MAX_CLAIMED_CREDIT, MIN_CLAIMED_CREDIT,
|
|
|
|
subclause, NJOBS
|
2009-11-04 21:23:56 +00:00
|
|
|
);
|
|
|
|
|
2009-11-10 21:00:29 +00:00
|
|
|
int n=0, nstats=0, rsc_type;
|
|
|
|
double total_old_credit = 0;
|
|
|
|
double total_new_credit = 0;
|
2009-11-10 23:39:51 +00:00
|
|
|
printf("DB query: select * from result %s\n", clause);
|
2009-11-04 21:23:56 +00:00
|
|
|
while (!r.enumerate(clause)) {
|
2009-11-10 21:00:29 +00:00
|
|
|
printf("%d) result %d host %d\n", n, r.id, r.hostid);
|
|
|
|
|
|
|
|
// Compute or estimate peak FLOP count (PFC).
|
|
|
|
// This is done as follows:
|
|
|
|
// if new client (reports elapsed time etc.)
|
|
|
|
// if anonymous platform
|
|
|
|
// user may not have set flops_estimate correctly.
|
|
|
|
// So, if it looks like CUDA app (from stderr)
|
|
|
|
// use the CUDA average PFC (but don't update the CUDA avg)
|
|
|
|
// Otherwise use CPU speed
|
|
|
|
// else
|
|
|
|
// use ET*flops_est
|
|
|
|
// else
|
|
|
|
// if it looks like CUDA app, use CUDA avg
|
|
|
|
// else use CPU
|
|
|
|
//
|
|
|
|
double pfc;
|
|
|
|
APP_VERSION* avp = NULL;
|
|
|
|
DB_HOST host;
|
|
|
|
if (r.elapsed_time && r.flops_estimate && r.app_version_id) {
|
|
|
|
// new client
|
|
|
|
if (r.app_version_id < 0) {
|
|
|
|
rsc_type = get_rsc_type(r);
|
|
|
|
printf(" anonymous platform, rsc type %s\n",
|
|
|
|
rsc_type_name(rsc_type)
|
|
|
|
);
|
|
|
|
avp = lookup_av_anon(r.appid, rsc_type);
|
|
|
|
if (!avp) {
|
|
|
|
printf(" no version for resource type %s; skipping\n",
|
|
|
|
rsc_type_name(rsc_type)
|
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (avp->pfc.n < 10) {
|
|
|
|
printf(
|
|
|
|
" app version %d has too few samples %f; skipping\n",
|
|
|
|
avp->id, avp->pfc.n
|
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
pfc = avp->pfc.get_mean();
|
|
|
|
printf(" using mean PFC: %.0fG\n", pfc/1e9);
|
|
|
|
printf(" PFC: %.0fG raw credit: %.2f\n",
|
|
|
|
pfc/1e9, pfc*COBBLESTONE_SCALE
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
pfc = r.elapsed_time * r.flops_estimate;
|
|
|
|
avp = lookup_av(r.app_version_id);
|
|
|
|
printf(" sec: %.0f GFLOPS: %.0f PFC: %.0fG raw credit: %.2f\n",
|
|
|
|
r.elapsed_time, r.flops_estimate/1e9, pfc/1e9, pfc*COBBLESTONE_SCALE
|
|
|
|
);
|
|
|
|
avp->pfc.update(pfc);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// old client
|
|
|
|
rsc_type = get_rsc_type(r);
|
|
|
|
if (rsc_type != RSC_TYPE_CPU) {
|
|
|
|
// ignore GPU jobs since old client doesn't report elapsed time
|
|
|
|
|
|
|
|
printf(" old client, GPU app: skipping\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
printf(" (old client)\n");
|
|
|
|
|
|
|
|
lookup_host(host, r.hostid);
|
2009-11-12 00:40:30 +00:00
|
|
|
avp = lookup_av_old(r.appid, host);
|
|
|
|
if (!avp) continue;
|
2009-11-10 21:00:29 +00:00
|
|
|
r.elapsed_time = r.cpu_time;
|
|
|
|
r.flops_estimate = host.p_fpops;
|
|
|
|
pfc = r.elapsed_time * r.flops_estimate;
|
|
|
|
printf(" sec: %.0f GFLOPS: %.0f PFC: %.0fG raw credit: %.2f\n",
|
|
|
|
r.elapsed_time, r.flops_estimate/1e9, pfc/1e9, pfc*COBBLESTONE_SCALE
|
|
|
|
);
|
2009-11-12 00:40:30 +00:00
|
|
|
avp->pfc.update(pfc);
|
2009-11-10 21:00:29 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 21:23:56 +00:00
|
|
|
|
2009-11-04 23:04:07 +00:00
|
|
|
APP& app = lookup_app(r.appid);
|
|
|
|
|
2009-11-10 21:00:29 +00:00
|
|
|
double vnpfc = pfc;
|
2009-11-04 23:04:07 +00:00
|
|
|
|
2009-11-10 21:00:29 +00:00
|
|
|
if (avp) {
|
|
|
|
vnpfc *= avp->pfc_scale_factor;
|
|
|
|
PLATFORM* p = lookup_platform(avp->platformid);
|
|
|
|
printf(" version scale (%s %s): %f\n",
|
|
|
|
p->name, avp->plan_class, avp->pfc_scale_factor
|
|
|
|
);
|
2009-11-04 23:04:07 +00:00
|
|
|
}
|
2009-11-04 21:23:56 +00:00
|
|
|
|
|
|
|
// host normalization
|
|
|
|
|
2009-11-12 00:22:33 +00:00
|
|
|
HOST_APP_VERSION& hav = lookup_host_app_version(
|
|
|
|
r.hostid, avp?avp->id:-1
|
|
|
|
);
|
2009-11-04 23:04:07 +00:00
|
|
|
double host_scale = 1;
|
2009-11-12 00:22:33 +00:00
|
|
|
|
|
|
|
// only apply it if have at MIN_HOST_SCALE_SAMPLES
|
|
|
|
if (hav.vnpfc.n >= MIN_HOST_SCALE_SAMPLES) {
|
|
|
|
host_scale = app.vnpfc.get_mean()/hav.vnpfc.get_mean();
|
2009-11-10 21:00:29 +00:00
|
|
|
// if (host_scale > 1) host_scale = 1;
|
|
|
|
printf(" host scale: %f\n", host_scale);
|
2009-11-04 23:04:07 +00:00
|
|
|
}
|
|
|
|
double claimed_flops = vnpfc * host_scale;
|
2009-11-10 21:00:29 +00:00
|
|
|
double new_claimed_credit = claimed_flops * COBBLESTONE_SCALE;
|
|
|
|
|
|
|
|
app.vnpfc.update(vnpfc);
|
2009-11-12 00:22:33 +00:00
|
|
|
hav.vnpfc.update(vnpfc);
|
2009-11-04 21:23:56 +00:00
|
|
|
|
2009-11-10 21:00:29 +00:00
|
|
|
printf(" new credit %.2f old credit %.2f\n",
|
|
|
|
new_claimed_credit, r.claimed_credit
|
2009-11-04 21:23:56 +00:00
|
|
|
);
|
|
|
|
|
2009-11-10 21:00:29 +00:00
|
|
|
if (accumulate_stats) {
|
|
|
|
total_old_credit += r.claimed_credit;
|
|
|
|
total_new_credit += new_claimed_credit;
|
|
|
|
nstats++;
|
|
|
|
}
|
2009-11-04 21:23:56 +00:00
|
|
|
|
|
|
|
n++;
|
|
|
|
|
2009-11-12 00:22:33 +00:00
|
|
|
if (n%SCALE_AV_PERIOD ==0) {
|
2009-11-04 21:23:56 +00:00
|
|
|
update_av_scales();
|
|
|
|
}
|
2009-11-12 00:22:33 +00:00
|
|
|
if (n%PRINT_AV_PERIOD ==0) {
|
2009-11-10 21:00:29 +00:00
|
|
|
print_avs();
|
|
|
|
}
|
2009-11-04 21:23:56 +00:00
|
|
|
}
|
2009-11-10 23:39:51 +00:00
|
|
|
if (nstats == 0) {
|
|
|
|
printf("Insufficient jobs were read from DB\n");
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
2009-11-04 23:04:07 +00:00
|
|
|
print_avs();
|
2009-11-10 21:00:29 +00:00
|
|
|
|
2009-11-12 00:40:30 +00:00
|
|
|
printf("Average credit: old %.2f new %.2f (ratio %.2f)\n",
|
|
|
|
total_old_credit/nstats, total_new_credit/nstats,
|
|
|
|
total_new_credit/total_old_credit
|
|
|
|
);
|
2009-11-12 00:22:33 +00:00
|
|
|
//printf("Variance claimed to grant old credit: %f\n", sqrt(variance_old/nstats));
|
|
|
|
//printf("Variance claimed to grant old credit: %f\n", sqrt(variance_old/nstats));
|
2009-11-04 21:23:56 +00:00
|
|
|
}
|