|
|
@ -71,6 +71,7 @@ struct pool_stats { |
|
|
|
double dsps60; |
|
|
|
double dsps60; |
|
|
|
double dsps360; |
|
|
|
double dsps360; |
|
|
|
double dsps1440; |
|
|
|
double dsps1440; |
|
|
|
|
|
|
|
double dsps10080; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
typedef struct pool_stats pool_stats_t; |
|
|
|
typedef struct pool_stats pool_stats_t; |
|
|
@ -227,6 +228,7 @@ struct user_instance { |
|
|
|
double dsps5; /* ... 5 minute ... */ |
|
|
|
double dsps5; /* ... 5 minute ... */ |
|
|
|
double dsps60;/* etc */ |
|
|
|
double dsps60;/* etc */ |
|
|
|
double dsps1440; |
|
|
|
double dsps1440; |
|
|
|
|
|
|
|
double dsps10080; |
|
|
|
tv_t last_share; |
|
|
|
tv_t last_share; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -269,6 +271,7 @@ struct stratum_instance { |
|
|
|
double dsps5; /* ... 5 minute ... */ |
|
|
|
double dsps5; /* ... 5 minute ... */ |
|
|
|
double dsps60;/* etc */ |
|
|
|
double dsps60;/* etc */ |
|
|
|
double dsps1440; |
|
|
|
double dsps1440; |
|
|
|
|
|
|
|
double dsps10080; |
|
|
|
tv_t ldc; /* Last diff change */ |
|
|
|
tv_t ldc; /* Last diff change */ |
|
|
|
int ssdc; /* Shares since diff change */ |
|
|
|
int ssdc; /* Shares since diff change */ |
|
|
|
tv_t first_share; |
|
|
|
tv_t first_share; |
|
|
@ -1920,6 +1923,7 @@ static void add_submit(ckpool_t *ckp, stratum_instance_t *client, int diff, bool |
|
|
|
decay_time(&client->dsps5, diff, tdiff, 300); |
|
|
|
decay_time(&client->dsps5, diff, tdiff, 300); |
|
|
|
decay_time(&client->dsps60, diff, tdiff, 3600); |
|
|
|
decay_time(&client->dsps60, diff, tdiff, 3600); |
|
|
|
decay_time(&client->dsps1440, diff, tdiff, 86400); |
|
|
|
decay_time(&client->dsps1440, diff, tdiff, 86400); |
|
|
|
|
|
|
|
decay_time(&client->dsps10080, diff, tdiff, 604800); |
|
|
|
copy_tv(&client->last_share, &now_t); |
|
|
|
copy_tv(&client->last_share, &now_t); |
|
|
|
|
|
|
|
|
|
|
|
tdiff = sane_tdiff(&now_t, &worker->last_share); |
|
|
|
tdiff = sane_tdiff(&now_t, &worker->last_share); |
|
|
@ -1934,6 +1938,7 @@ static void add_submit(ckpool_t *ckp, stratum_instance_t *client, int diff, bool |
|
|
|
decay_time(&instance->dsps5, diff, tdiff, 300); |
|
|
|
decay_time(&instance->dsps5, diff, tdiff, 300); |
|
|
|
decay_time(&instance->dsps60, diff, tdiff, 3600); |
|
|
|
decay_time(&instance->dsps60, diff, tdiff, 3600); |
|
|
|
decay_time(&instance->dsps1440, diff, tdiff, 86400); |
|
|
|
decay_time(&instance->dsps1440, diff, tdiff, 86400); |
|
|
|
|
|
|
|
decay_time(&instance->dsps10080, diff, tdiff, 604800); |
|
|
|
copy_tv(&instance->last_share, &now_t); |
|
|
|
copy_tv(&instance->last_share, &now_t); |
|
|
|
client->idle = false; |
|
|
|
client->idle = false; |
|
|
|
|
|
|
|
|
|
|
@ -3141,11 +3146,11 @@ static void *statsupdate(void *arg) |
|
|
|
sleep(1); |
|
|
|
sleep(1); |
|
|
|
|
|
|
|
|
|
|
|
while (42) { |
|
|
|
while (42) { |
|
|
|
double ghs, ghs1, ghs5, ghs15, ghs60, ghs360, ghs1440; |
|
|
|
double ghs, ghs1, ghs5, ghs15, ghs60, ghs360, ghs1440, ghs10080; |
|
|
|
double bias, bias5, bias60, bias1440; |
|
|
|
double bias, bias5, bias60, bias1440; |
|
|
|
double tdiff, per_tdiff; |
|
|
|
double tdiff, per_tdiff; |
|
|
|
char suffix1[16], suffix5[16], suffix15[16], suffix60[16], cdfield[64]; |
|
|
|
char suffix1[16], suffix5[16], suffix15[16], suffix60[16], cdfield[64]; |
|
|
|
char suffix360[16], suffix1440[16]; |
|
|
|
char suffix360[16], suffix1440[16], suffix10080[16]; |
|
|
|
user_instance_t *instance, *tmpuser; |
|
|
|
user_instance_t *instance, *tmpuser; |
|
|
|
stratum_instance_t *client, *tmp; |
|
|
|
stratum_instance_t *client, *tmp; |
|
|
|
double sps1, sps5, sps15, sps60; |
|
|
|
double sps1, sps5, sps15, sps60; |
|
|
@ -3188,6 +3193,10 @@ static void *statsupdate(void *arg) |
|
|
|
ghs1440 = stats.dsps1440 * nonces / bias1440; |
|
|
|
ghs1440 = stats.dsps1440 * nonces / bias1440; |
|
|
|
suffix_string(ghs1440, suffix1440, 16, 0); |
|
|
|
suffix_string(ghs1440, suffix1440, 16, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bias = time_bias(tdiff, 604800); |
|
|
|
|
|
|
|
ghs10080 = stats.dsps10080 * nonces / bias; |
|
|
|
|
|
|
|
suffix_string(ghs10080, suffix10080, 16, 0); |
|
|
|
|
|
|
|
|
|
|
|
snprintf(fname, 511, "%s/pool/pool.status", ckp->logdir); |
|
|
|
snprintf(fname, 511, "%s/pool/pool.status", ckp->logdir); |
|
|
|
fp = fopen(fname, "we"); |
|
|
|
fp = fopen(fname, "we"); |
|
|
|
if (unlikely(!fp)) |
|
|
|
if (unlikely(!fp)) |
|
|
@ -3203,13 +3212,14 @@ static void *statsupdate(void *arg) |
|
|
|
fprintf(fp, "%s\n", s); |
|
|
|
fprintf(fp, "%s\n", s); |
|
|
|
dealloc(s); |
|
|
|
dealloc(s); |
|
|
|
|
|
|
|
|
|
|
|
JSON_CPACK(val, "{ss,ss,ss,ss,ss,ss}", |
|
|
|
JSON_CPACK(val, "{ss,ss,ss,ss,ss,ss,ss}", |
|
|
|
"hashrate1m", suffix1, |
|
|
|
"hashrate1m", suffix1, |
|
|
|
"hashrate5m", suffix5, |
|
|
|
"hashrate5m", suffix5, |
|
|
|
"hashrate15m", suffix15, |
|
|
|
"hashrate15m", suffix15, |
|
|
|
"hashrate1hr", suffix60, |
|
|
|
"hashrate1hr", suffix60, |
|
|
|
"hashrate6hr", suffix360, |
|
|
|
"hashrate6hr", suffix360, |
|
|
|
"hashrate1d", suffix1440); |
|
|
|
"hashrate1d", suffix1440, |
|
|
|
|
|
|
|
"hashrate7d", suffix10080); |
|
|
|
s = json_dumps(val, JSON_NO_UTF8 | JSON_PRESERVE_ORDER); |
|
|
|
s = json_dumps(val, JSON_NO_UTF8 | JSON_PRESERVE_ORDER); |
|
|
|
json_decref(val); |
|
|
|
json_decref(val); |
|
|
|
LOGNOTICE("Pool:%s", s); |
|
|
|
LOGNOTICE("Pool:%s", s); |
|
|
@ -3241,6 +3251,7 @@ static void *statsupdate(void *arg) |
|
|
|
decay_time(&client->dsps5, 0, per_tdiff, 300); |
|
|
|
decay_time(&client->dsps5, 0, per_tdiff, 300); |
|
|
|
decay_time(&client->dsps60, 0, per_tdiff, 3600); |
|
|
|
decay_time(&client->dsps60, 0, per_tdiff, 3600); |
|
|
|
decay_time(&client->dsps1440, 0, per_tdiff, 86400); |
|
|
|
decay_time(&client->dsps1440, 0, per_tdiff, 86400); |
|
|
|
|
|
|
|
decay_time(&client->dsps10080, 0, per_tdiff, 604800); |
|
|
|
if (per_tdiff > 600) |
|
|
|
if (per_tdiff > 600) |
|
|
|
client->idle = true; |
|
|
|
client->idle = true; |
|
|
|
continue; |
|
|
|
continue; |
|
|
@ -3298,6 +3309,7 @@ static void *statsupdate(void *arg) |
|
|
|
decay_time(&instance->dsps5, 0, per_tdiff, 300); |
|
|
|
decay_time(&instance->dsps5, 0, per_tdiff, 300); |
|
|
|
decay_time(&instance->dsps60, 0, per_tdiff, 3600); |
|
|
|
decay_time(&instance->dsps60, 0, per_tdiff, 3600); |
|
|
|
decay_time(&instance->dsps1440, 0, per_tdiff, 86400); |
|
|
|
decay_time(&instance->dsps1440, 0, per_tdiff, 86400); |
|
|
|
|
|
|
|
decay_time(&instance->dsps10080, 0, per_tdiff, 604800); |
|
|
|
idle = true; |
|
|
|
idle = true; |
|
|
|
} |
|
|
|
} |
|
|
|
ghs = instance->dsps1 * nonces; |
|
|
|
ghs = instance->dsps1 * nonces; |
|
|
@ -3311,12 +3323,15 @@ static void *statsupdate(void *arg) |
|
|
|
|
|
|
|
|
|
|
|
ghs = instance->dsps1440 * nonces / bias1440; |
|
|
|
ghs = instance->dsps1440 * nonces / bias1440; |
|
|
|
suffix_string(ghs, suffix1440, 16, 0); |
|
|
|
suffix_string(ghs, suffix1440, 16, 0); |
|
|
|
|
|
|
|
ghs = instance->dsps10080 * nonces; |
|
|
|
|
|
|
|
suffix_string(ghs, suffix10080, 16, 0); |
|
|
|
|
|
|
|
|
|
|
|
JSON_CPACK(val, "{ss,ss,ss,ss,si}", |
|
|
|
JSON_CPACK(val, "{ss,ss,ss,ss,ss,si}", |
|
|
|
"hashrate1m", suffix1, |
|
|
|
"hashrate1m", suffix1, |
|
|
|
"hashrate5m", suffix5, |
|
|
|
"hashrate5m", suffix5, |
|
|
|
"hashrate1hr", suffix60, |
|
|
|
"hashrate1hr", suffix60, |
|
|
|
"hashrate1d", suffix1440, |
|
|
|
"hashrate1d", suffix1440, |
|
|
|
|
|
|
|
"hashrate7d", suffix10080, |
|
|
|
"workers", instance->workers); |
|
|
|
"workers", instance->workers); |
|
|
|
|
|
|
|
|
|
|
|
snprintf(fname, 511, "%s/users/%s", ckp->logdir, instance->username); |
|
|
|
snprintf(fname, 511, "%s/users/%s", ckp->logdir, instance->username); |
|
|
@ -3375,6 +3390,7 @@ static void *statsupdate(void *arg) |
|
|
|
decay_time(&stats.dsps60, stats.unaccounted_diff_shares, 20, 3600); |
|
|
|
decay_time(&stats.dsps60, stats.unaccounted_diff_shares, 20, 3600); |
|
|
|
decay_time(&stats.dsps360, stats.unaccounted_diff_shares, 20, 21600); |
|
|
|
decay_time(&stats.dsps360, stats.unaccounted_diff_shares, 20, 21600); |
|
|
|
decay_time(&stats.dsps1440, stats.unaccounted_diff_shares, 20, 86400); |
|
|
|
decay_time(&stats.dsps1440, stats.unaccounted_diff_shares, 20, 86400); |
|
|
|
|
|
|
|
decay_time(&stats.dsps10080, stats.unaccounted_diff_shares, 20, 604800); |
|
|
|
|
|
|
|
|
|
|
|
stats.unaccounted_shares = |
|
|
|
stats.unaccounted_shares = |
|
|
|
stats.unaccounted_diff_shares = |
|
|
|
stats.unaccounted_diff_shares = |
|
|
|