Browse Source

ckdb - define fields for per user pool stats and set total invalids as diffinv

master
kanoi 10 years ago
parent
commit
9b433a20bd
  1. 25
      src/ckdb.c

25
src/ckdb.c

@ -234,7 +234,7 @@ static LOADSTATUS dbstatus;
typedef struct poolstatus { typedef struct poolstatus {
int64_t workinfoid; // Last block int64_t workinfoid; // Last block
double diffacc; double diffacc;
double differr; double diffinv;
double best_sdiff; // TODO double best_sdiff; // TODO
} POOLSTATUS; } POOLSTATUS;
static POOLSTATUS pool; static POOLSTATUS pool;
@ -1510,6 +1510,11 @@ typedef struct workerstatus {
double last_diff; double last_diff;
tv_t last_stats; tv_t last_stats;
tv_t last_idle; tv_t last_idle;
// Below gets reset on each block
double diffacc;
double diffinv; // Non-acc
double shareacc;
double shareinv; // Non-acc
} WORKERSTATUS; } WORKERSTATUS;
#define ALLOC_WORKERSTATUS 1000 #define ALLOC_WORKERSTATUS 1000
@ -4481,7 +4486,7 @@ static bool shares_add(PGconn *conn, char *workinfoid, char *username, char *wor
if (sharesummary->workinfoid >= pool.workinfoid) { if (sharesummary->workinfoid >= pool.workinfoid) {
// Negate coz the shares will re-add // Negate coz the shares will re-add
pool.diffacc -= sharesummary->sharecount; pool.diffacc -= sharesummary->sharecount;
pool.differr -= sharesummary->errorcount; pool.diffinv -= sharesummary->errorcount;
} }
zero_sharesummary(sharesummary, cd, shares->diff); zero_sharesummary(sharesummary, cd, shares->diff);
sharesummary->reset = true; sharesummary->reset = true;
@ -4618,7 +4623,7 @@ static bool shareerrors_add(PGconn *conn, char *workinfoid, char *username,
if (sharesummary->workinfoid >= pool.workinfoid) { if (sharesummary->workinfoid >= pool.workinfoid) {
// Negate coz the shares will re-add // Negate coz the shares will re-add
pool.diffacc -= sharesummary->sharecount; pool.diffacc -= sharesummary->sharecount;
pool.differr -= sharesummary->errorcount; pool.diffinv -= sharesummary->errorcount;
} }
zero_sharesummary(sharesummary, cd, 0.0); zero_sharesummary(sharesummary, cd, 0.0);
sharesummary->reset = true; sharesummary->reset = true;
@ -4799,25 +4804,25 @@ static bool _sharesummary_update(PGconn *conn, SHARES *s_row, SHAREERRORS *e_row
row->diffsta += s_row->diff; row->diffsta += s_row->diff;
row->sharesta++; row->sharesta++;
if (row->workinfoid >= pool.workinfoid) if (row->workinfoid >= pool.workinfoid)
pool.differr += s_row->diff; pool.diffinv += s_row->diff;
break; break;
case SE_DUPE: case SE_DUPE:
row->diffdup += s_row->diff; row->diffdup += s_row->diff;
row->sharedup++; row->sharedup++;
if (row->workinfoid >= pool.workinfoid) if (row->workinfoid >= pool.workinfoid)
pool.differr += s_row->diff; pool.diffinv += s_row->diff;
break; break;
case SE_HIGH_DIFF: case SE_HIGH_DIFF:
row->diffhi += s_row->diff; row->diffhi += s_row->diff;
row->sharehi++; row->sharehi++;
if (row->workinfoid >= pool.workinfoid) if (row->workinfoid >= pool.workinfoid)
pool.differr += s_row->diff; pool.diffinv += s_row->diff;
break; break;
default: default:
row->diffrej += s_row->diff; row->diffrej += s_row->diff;
row->sharerej++; row->sharerej++;
if (row->workinfoid >= pool.workinfoid) if (row->workinfoid >= pool.workinfoid)
pool.differr += s_row->diff; pool.diffinv += s_row->diff;
break; break;
} }
} }
@ -5209,7 +5214,7 @@ static bool sharesummary_fill(PGconn *conn)
if (row->workinfoid >= pool.workinfoid) { if (row->workinfoid >= pool.workinfoid) {
pool.diffacc += row->diffacc; pool.diffacc += row->diffacc;
pool.differr += row->diffsta + row->diffdup + pool.diffinv += row->diffsta + row->diffdup +
row->diffhi + row->diffrej; row->diffhi + row->diffrej;
} }
@ -5621,7 +5626,7 @@ flail:
pool.diffacc, est, pct, cd_buf); pool.diffacc, est, pct, cd_buf);
if (pool.workinfoid < row->workinfoid) { if (pool.workinfoid < row->workinfoid) {
pool.workinfoid = row->workinfoid; pool.workinfoid = row->workinfoid;
pool.diffacc = pool.differr = pool.diffacc = pool.diffinv =
pool.best_sdiff = 0.0; pool.best_sdiff = 0.0;
} }
break; break;
@ -9147,7 +9152,7 @@ static char *cmd_homepage(__maybe_unused PGconn *conn, char *cmd, char *id,
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "blockerr=%.1f%c", snprintf(tmp, sizeof(tmp), "blockerr=%.1f%c",
pool.differr, FLDSEP); pool.diffinv, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
// TODO: assumes only one poolinstance (for now) // TODO: assumes only one poolinstance (for now)

Loading…
Cancel
Save