Browse Source

ckdb - share invalid breakdown per worker

master
kanoi 10 years ago
parent
commit
7b119f05a3
  1. 106
      src/ckdb.c

106
src/ckdb.c

@ -49,7 +49,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "0.9.2" #define DB_VERSION "0.9.2"
#define CKDB_VERSION DB_VERSION"-0.322" #define CKDB_VERSION DB_VERSION"-0.325"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@ -1565,8 +1565,16 @@ typedef struct workerstatus {
// Below gets reset on each block // Below gets reset on each block
double diffacc; double diffacc;
double diffinv; // Non-acc double diffinv; // Non-acc
double diffsta;
double diffdup;
double diffhi;
double diffrej;
double shareacc; double shareacc;
double shareinv; // Non-acc double shareinv; // Non-acc
double sharesta;
double sharedup;
double sharehi;
double sharerej;
} WORKERSTATUS; } WORKERSTATUS;
#define ALLOC_WORKERSTATUS 1000 #define ALLOC_WORKERSTATUS 1000
@ -2461,7 +2469,11 @@ static void zero_on_new_block()
while (ws_item) { while (ws_item) {
DATA_WORKERSTATUS(workerstatus, ws_item); DATA_WORKERSTATUS(workerstatus, ws_item);
workerstatus->diffacc = workerstatus->diffinv = workerstatus->diffacc = workerstatus->diffinv =
workerstatus->shareacc = workerstatus->shareinv = 0.0; workerstatus->diffsta = workerstatus->diffdup =
workerstatus->diffhi = workerstatus->diffrej =
workerstatus->shareacc = workerstatus->shareinv =
workerstatus->sharesta = workerstatus->sharedup =
workerstatus->sharehi = workerstatus->sharerej = 0.0;
ws_item = next_in_ktree(ctx); ws_item = next_in_ktree(ctx);
} }
K_WUNLOCK(workerstatus_free); K_WUNLOCK(workerstatus_free);
@ -2530,9 +2542,17 @@ static void set_block_share_counters()
workerstatus->diffacc += sharesummary->diffacc; workerstatus->diffacc += sharesummary->diffacc;
workerstatus->diffinv += sharesummary->diffsta + sharesummary->diffdup + workerstatus->diffinv += sharesummary->diffsta + sharesummary->diffdup +
sharesummary->diffhi + sharesummary->diffrej; sharesummary->diffhi + sharesummary->diffrej;
workerstatus->diffsta += sharesummary->diffsta;
workerstatus->diffdup += sharesummary->diffdup;
workerstatus->diffhi += sharesummary->diffhi;
workerstatus->diffrej += sharesummary->diffrej;
workerstatus->shareacc += sharesummary->shareacc; workerstatus->shareacc += sharesummary->shareacc;
workerstatus->shareinv += sharesummary->sharesta + sharesummary->sharedup + workerstatus->shareinv += sharesummary->sharesta + sharesummary->sharedup +
sharesummary->sharehi + sharesummary->sharerej; sharesummary->sharehi + sharesummary->sharerej;
workerstatus->sharesta += sharesummary->sharesta;
workerstatus->sharedup += sharesummary->sharedup;
workerstatus->sharehi += sharesummary->sharehi;
workerstatus->sharerej += sharesummary->sharerej;
ss_item = prev_in_ktree(ctx); ss_item = prev_in_ktree(ctx);
} }
@ -2636,12 +2656,35 @@ static void _workerstatus_update(AUTHS *auths, SHARES *shares,
copy_tv(&(row->last_share), &(shares->createdate)); copy_tv(&(row->last_share), &(shares->createdate));
row->last_diff = shares->diff; row->last_diff = shares->diff;
} }
if (shares->errn == SE_NONE) { switch (shares->errn) {
case SE_NONE:
row->diffacc += shares->diff; row->diffacc += shares->diff;
row->shareacc++; row->shareacc++;
} else { break;
case SE_STALE:
row->diffinv += shares->diff;
row->shareinv++;
row->diffsta += shares->diff;
row->sharesta++;
break;
case SE_DUPE:
row->diffinv += shares->diff;
row->shareinv++;
row->diffdup += shares->diff;
row->sharedup++;
break;
case SE_HIGH_DIFF:
row->diffinv += shares->diff; row->diffinv += shares->diff;
row->shareinv++; row->shareinv++;
row->diffhi += shares->diff;
row->sharehi++;
break;
default:
row->diffinv += shares->diff;
row->shareinv++;
row->diffrej += shares->diff;
row->sharerej++;
break;
} }
} }
} }
@ -9723,13 +9766,21 @@ static char *cmd_workers(__maybe_unused PGconn *conn, char *cmd, char *id,
int64_t w_elapsed; int64_t w_elapsed;
tv_t w_lastshare; tv_t w_lastshare;
double w_lastdiff, w_diffacc, w_diffinv; double w_lastdiff, w_diffacc, w_diffinv;
double w_diffsta, w_diffdup;
double w_diffhi, w_diffrej;
double w_shareacc, w_shareinv; double w_shareacc, w_shareinv;
double w_sharesta, w_sharedup;
double w_sharehi, w_sharerej;
w_hashrate5m = w_hashrate1hr = 0.0; w_hashrate5m = w_hashrate1hr = 0.0;
w_elapsed = -1; w_elapsed = -1;
w_lastshare.tv_sec = 0; w_lastshare.tv_sec = 0;
w_lastdiff = w_diffacc = w_diffinv = w_lastdiff = w_diffacc = w_diffinv =
w_shareacc = w_shareinv = 0; w_diffsta = w_diffdup =
w_diffhi = w_diffrej =
w_shareacc = w_shareinv =
w_sharesta = w_sharedup =
w_sharehi = w_sharerej = 0;
ws_item = find_workerstatus(users->userid, workers->workername, ws_item = find_workerstatus(users->userid, workers->workername,
__FILE__, __func__, __LINE__); __FILE__, __func__, __LINE__);
@ -9739,8 +9790,16 @@ static char *cmd_workers(__maybe_unused PGconn *conn, char *cmd, char *id,
w_lastdiff = workerstatus->last_diff; w_lastdiff = workerstatus->last_diff;
w_diffacc = workerstatus->diffacc; w_diffacc = workerstatus->diffacc;
w_diffinv = workerstatus->diffinv; w_diffinv = workerstatus->diffinv;
w_diffsta = workerstatus->diffsta;
w_diffdup = workerstatus->diffdup;
w_diffhi = workerstatus->diffhi;
w_diffrej = workerstatus->diffrej;
w_shareacc = workerstatus->shareacc; w_shareacc = workerstatus->shareacc;
w_shareinv = workerstatus->shareinv; w_shareinv = workerstatus->shareinv;
w_sharesta = workerstatus->sharesta;
w_sharedup = workerstatus->sharedup;
w_sharehi = workerstatus->sharehi;
w_sharerej = workerstatus->sharerej;
} }
// find last stored userid record // find last stored userid record
@ -9804,6 +9863,22 @@ static char *cmd_workers(__maybe_unused PGconn *conn, char *cmd, char *id,
snprintf(tmp, sizeof(tmp), "w_diffinv:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_diffinv:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_diffsta, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_diffsta:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_diffdup, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_diffdup:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_diffhi, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_diffhi:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_diffrej, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_diffrej:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_shareacc, reply, sizeof(reply)); double_to_buf(w_shareacc, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_shareacc:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_shareacc:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
@ -9812,6 +9887,22 @@ static char *cmd_workers(__maybe_unused PGconn *conn, char *cmd, char *id,
snprintf(tmp, sizeof(tmp), "w_shareinv:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_shareinv:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_sharesta, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_sharesta:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_sharedup, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_sharedup:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_sharehi, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_sharehi:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_sharerej, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_sharerej:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
userstats_workername_root = free_ktree(userstats_workername_root, NULL); userstats_workername_root = free_ktree(userstats_workername_root, NULL);
K_RUNLOCK(userstats_free); K_RUNLOCK(userstats_free);
} }
@ -9827,7 +9918,10 @@ static char *cmd_workers(__maybe_unused PGconn *conn, char *cmd, char *id,
"workername,difficultydefault,idlenotificationenabled," "workername,difficultydefault,idlenotificationenabled,"
"idlenotificationtime", "idlenotificationtime",
stats ? ",w_hashrate5m,w_hashrate1hr,w_elapsed,w_lastshare," stats ? ",w_hashrate5m,w_hashrate1hr,w_elapsed,w_lastshare,"
"w_lastdiff,w_diffacc,w_diffinv,w_shareacc,w_shareinv" : "", "w_lastdiff,w_diffacc,w_diffinv,"
"w_diffsta,w_diffdup,w_diffhi,w_diffrej,"
"w_shareacc,w_shareinv,"
"w_sharesta,w_sharedup,w_sharehi,w_sharerej" : "",
FLDSEP); FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);

Loading…
Cancel
Save