|
|
|
@ -871,6 +871,18 @@ K_ITEM *_find_create_workerstatus(int64_t userid, char *workername,
|
|
|
|
|
return ws_item; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// workerstatus must be locked
|
|
|
|
|
static void zero_on_idle(tv_t *when, WORKERSTATUS *workerstatus) |
|
|
|
|
{ |
|
|
|
|
copy_tv(&(workerstatus->active_start), when); |
|
|
|
|
workerstatus->active_diffacc = workerstatus->active_diffinv = |
|
|
|
|
workerstatus->active_diffsta = workerstatus->active_diffdup = |
|
|
|
|
workerstatus->active_diffhi = workerstatus->active_diffrej = |
|
|
|
|
workerstatus->active_shareacc = workerstatus->active_shareinv = |
|
|
|
|
workerstatus->active_sharesta = workerstatus->active_sharedup = |
|
|
|
|
workerstatus->active_sharehi = workerstatus->active_sharerej = 0.0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* All data is loaded, now update workerstatus fields
|
|
|
|
|
TODO: combine set_block_share_counters() with this? */ |
|
|
|
|
void workerstatus_ready() |
|
|
|
@ -939,6 +951,8 @@ void _workerstatus_update(AUTHS *auths, SHARES *shares,
|
|
|
|
|
K_WLOCK(workerstatus_free); |
|
|
|
|
if (tv_newer(&(row->last_auth), &(auths->createdate))) |
|
|
|
|
copy_tv(&(row->last_auth), &(auths->createdate)); |
|
|
|
|
if (row->active_start.tv_sec == 0) |
|
|
|
|
copy_tv(&(row->active_start), &(auths->createdate)); |
|
|
|
|
K_WUNLOCK(workerstatus_free); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -960,34 +974,54 @@ void _workerstatus_update(AUTHS *auths, SHARES *shares,
|
|
|
|
|
copy_tv(&(row->last_share), &(shares->createdate)); |
|
|
|
|
row->last_diff = shares->diff; |
|
|
|
|
} |
|
|
|
|
if (row->active_start.tv_sec == 0) |
|
|
|
|
copy_tv(&(row->active_start), &(shares->createdate)); |
|
|
|
|
switch (shares->errn) { |
|
|
|
|
case SE_NONE: |
|
|
|
|
row->diffacc += shares->diff; |
|
|
|
|
row->shareacc++; |
|
|
|
|
row->block_diffacc += shares->diff; |
|
|
|
|
row->block_shareacc++; |
|
|
|
|
row->active_diffacc += shares->diff; |
|
|
|
|
row->active_shareacc++; |
|
|
|
|
break; |
|
|
|
|
case SE_STALE: |
|
|
|
|
row->diffinv += shares->diff; |
|
|
|
|
row->shareinv++; |
|
|
|
|
row->diffsta += shares->diff; |
|
|
|
|
row->sharesta++; |
|
|
|
|
row->block_diffinv += shares->diff; |
|
|
|
|
row->block_shareinv++; |
|
|
|
|
row->block_diffsta += shares->diff; |
|
|
|
|
row->block_sharesta++; |
|
|
|
|
row->active_diffinv += shares->diff; |
|
|
|
|
row->active_shareinv++; |
|
|
|
|
row->active_diffsta += shares->diff; |
|
|
|
|
row->active_sharesta++; |
|
|
|
|
break; |
|
|
|
|
case SE_DUPE: |
|
|
|
|
row->diffinv += shares->diff; |
|
|
|
|
row->shareinv++; |
|
|
|
|
row->diffdup += shares->diff; |
|
|
|
|
row->sharedup++; |
|
|
|
|
row->block_diffinv += shares->diff; |
|
|
|
|
row->block_shareinv++; |
|
|
|
|
row->block_diffdup += shares->diff; |
|
|
|
|
row->block_sharedup++; |
|
|
|
|
row->active_diffinv += shares->diff; |
|
|
|
|
row->active_shareinv++; |
|
|
|
|
row->active_diffdup += shares->diff; |
|
|
|
|
row->active_sharedup++; |
|
|
|
|
break; |
|
|
|
|
case SE_HIGH_DIFF: |
|
|
|
|
row->diffinv += shares->diff; |
|
|
|
|
row->shareinv++; |
|
|
|
|
row->diffhi += shares->diff; |
|
|
|
|
row->sharehi++; |
|
|
|
|
row->block_diffinv += shares->diff; |
|
|
|
|
row->block_shareinv++; |
|
|
|
|
row->block_diffhi += shares->diff; |
|
|
|
|
row->block_sharehi++; |
|
|
|
|
row->active_diffinv += shares->diff; |
|
|
|
|
row->active_shareinv++; |
|
|
|
|
row->active_diffhi += shares->diff; |
|
|
|
|
row->active_sharehi++; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
row->diffinv += shares->diff; |
|
|
|
|
row->shareinv++; |
|
|
|
|
row->diffrej += shares->diff; |
|
|
|
|
row->sharerej++; |
|
|
|
|
row->block_diffinv += shares->diff; |
|
|
|
|
row->block_shareinv++; |
|
|
|
|
row->block_diffrej += shares->diff; |
|
|
|
|
row->block_sharerej++; |
|
|
|
|
row->active_diffinv += shares->diff; |
|
|
|
|
row->active_shareinv++; |
|
|
|
|
row->active_diffrej += shares->diff; |
|
|
|
|
row->active_sharerej++; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
K_WUNLOCK(workerstatus_free); |
|
|
|
@ -1001,8 +1035,10 @@ void _workerstatus_update(AUTHS *auths, SHARES *shares,
|
|
|
|
|
DATA_WORKERSTATUS(row, item); |
|
|
|
|
K_WLOCK(workerstatus_free); |
|
|
|
|
if (userstats->idle) { |
|
|
|
|
if (tv_newer(&(row->last_idle), &(userstats->statsdate))) |
|
|
|
|
if (tv_newer(&(row->last_idle), &(userstats->statsdate))) { |
|
|
|
|
copy_tv(&(row->last_idle), &(userstats->statsdate)); |
|
|
|
|
zero_on_idle(&(userstats->statsdate), row); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (tv_newer(&(row->last_stats), &(userstats->statsdate))) |
|
|
|
|
copy_tv(&(row->last_stats), &(userstats->statsdate)); |
|
|
|
@ -2436,12 +2472,12 @@ void zero_on_new_block()
|
|
|
|
|
ws_item = first_in_ktree(workerstatus_root, ctx); |
|
|
|
|
while (ws_item) { |
|
|
|
|
DATA_WORKERSTATUS(workerstatus, ws_item); |
|
|
|
|
workerstatus->diffacc = workerstatus->diffinv = |
|
|
|
|
workerstatus->diffsta = workerstatus->diffdup = |
|
|
|
|
workerstatus->diffhi = workerstatus->diffrej = |
|
|
|
|
workerstatus->shareacc = workerstatus->shareinv = |
|
|
|
|
workerstatus->sharesta = workerstatus->sharedup = |
|
|
|
|
workerstatus->sharehi = workerstatus->sharerej = 0.0; |
|
|
|
|
workerstatus->block_diffacc = workerstatus->block_diffinv = |
|
|
|
|
workerstatus->block_diffsta = workerstatus->block_diffdup = |
|
|
|
|
workerstatus->block_diffhi = workerstatus->block_diffrej = |
|
|
|
|
workerstatus->block_shareacc = workerstatus->block_shareinv = |
|
|
|
|
workerstatus->block_sharesta = workerstatus->block_sharedup = |
|
|
|
|
workerstatus->block_sharehi = workerstatus->block_sharerej = 0.0; |
|
|
|
|
ws_item = next_in_ktree(ctx); |
|
|
|
|
} |
|
|
|
|
K_WUNLOCK(workerstatus_free); |
|
|
|
@ -2511,20 +2547,25 @@ void set_block_share_counters()
|
|
|
|
|
pool.diffacc += sharesummary->diffacc; |
|
|
|
|
pool.diffinv += sharesummary->diffsta + sharesummary->diffdup + |
|
|
|
|
sharesummary->diffhi + sharesummary->diffrej; |
|
|
|
|
workerstatus->diffacc += sharesummary->diffacc; |
|
|
|
|
workerstatus->diffinv += sharesummary->diffsta + sharesummary->diffdup + |
|
|
|
|
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->shareinv += sharesummary->sharesta + sharesummary->sharedup + |
|
|
|
|
sharesummary->sharehi + sharesummary->sharerej; |
|
|
|
|
workerstatus->sharesta += sharesummary->sharesta; |
|
|
|
|
workerstatus->sharedup += sharesummary->sharedup; |
|
|
|
|
workerstatus->sharehi += sharesummary->sharehi; |
|
|
|
|
workerstatus->sharerej += sharesummary->sharerej; |
|
|
|
|
// Block stats only
|
|
|
|
|
workerstatus->block_diffacc += sharesummary->diffacc; |
|
|
|
|
workerstatus->block_diffinv += sharesummary->diffsta + |
|
|
|
|
sharesummary->diffdup + |
|
|
|
|
sharesummary->diffhi + |
|
|
|
|
sharesummary->diffrej; |
|
|
|
|
workerstatus->block_diffsta += sharesummary->diffsta; |
|
|
|
|
workerstatus->block_diffdup += sharesummary->diffdup; |
|
|
|
|
workerstatus->block_diffhi += sharesummary->diffhi; |
|
|
|
|
workerstatus->block_diffrej += sharesummary->diffrej; |
|
|
|
|
workerstatus->block_shareacc += sharesummary->shareacc; |
|
|
|
|
workerstatus->block_shareinv += sharesummary->sharesta + |
|
|
|
|
sharesummary->sharedup + |
|
|
|
|
sharesummary->sharehi + |
|
|
|
|
sharesummary->sharerej; |
|
|
|
|
workerstatus->block_sharesta += sharesummary->sharesta; |
|
|
|
|
workerstatus->block_sharedup += sharesummary->sharedup; |
|
|
|
|
workerstatus->block_sharehi += sharesummary->sharehi; |
|
|
|
|
workerstatus->block_sharerej += sharesummary->sharerej; |
|
|
|
|
|
|
|
|
|
ss_item = prev_in_ktree(ctx); |
|
|
|
|
} |
|
|
|
@ -2589,20 +2630,25 @@ void set_block_share_counters()
|
|
|
|
|
pool.diffacc += markersummary->diffacc; |
|
|
|
|
pool.diffinv += markersummary->diffsta + markersummary->diffdup + |
|
|
|
|
markersummary->diffhi + markersummary->diffrej; |
|
|
|
|
workerstatus->diffacc += markersummary->diffacc; |
|
|
|
|
workerstatus->diffinv += markersummary->diffsta + markersummary->diffdup + |
|
|
|
|
markersummary->diffhi + markersummary->diffrej; |
|
|
|
|
workerstatus->diffsta += markersummary->diffsta; |
|
|
|
|
workerstatus->diffdup += markersummary->diffdup; |
|
|
|
|
workerstatus->diffhi += markersummary->diffhi; |
|
|
|
|
workerstatus->diffrej += markersummary->diffrej; |
|
|
|
|
workerstatus->shareacc += markersummary->shareacc; |
|
|
|
|
workerstatus->shareinv += markersummary->sharesta + markersummary->sharedup + |
|
|
|
|
markersummary->sharehi + markersummary->sharerej; |
|
|
|
|
workerstatus->sharesta += markersummary->sharesta; |
|
|
|
|
workerstatus->sharedup += markersummary->sharedup; |
|
|
|
|
workerstatus->sharehi += markersummary->sharehi; |
|
|
|
|
workerstatus->sharerej += markersummary->sharerej; |
|
|
|
|
// Block stats only
|
|
|
|
|
workerstatus->block_diffacc += markersummary->diffacc; |
|
|
|
|
workerstatus->block_diffinv += markersummary->diffsta + |
|
|
|
|
markersummary->diffdup + |
|
|
|
|
markersummary->diffhi + |
|
|
|
|
markersummary->diffrej; |
|
|
|
|
workerstatus->block_diffsta += markersummary->diffsta; |
|
|
|
|
workerstatus->block_diffdup += markersummary->diffdup; |
|
|
|
|
workerstatus->block_diffhi += markersummary->diffhi; |
|
|
|
|
workerstatus->block_diffrej += markersummary->diffrej; |
|
|
|
|
workerstatus->block_shareacc += markersummary->shareacc; |
|
|
|
|
workerstatus->block_shareinv += markersummary->sharesta + |
|
|
|
|
markersummary->sharedup + |
|
|
|
|
markersummary->sharehi + |
|
|
|
|
markersummary->sharerej; |
|
|
|
|
workerstatus->block_sharesta += markersummary->sharesta; |
|
|
|
|
workerstatus->block_sharedup += markersummary->sharedup; |
|
|
|
|
workerstatus->block_sharehi += markersummary->sharehi; |
|
|
|
|
workerstatus->block_sharerej += markersummary->sharerej; |
|
|
|
|
|
|
|
|
|
ms_item = prev_in_ktree(ctx_ms); |
|
|
|
|
} |
|
|
|
|