Merge pull request #193 from kanoi/master API add last share time to each pool + Correct Icarus U: & MH/s
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
diff --git a/api.c b/api.c
index 8571dcc..1bf9b2b 100644
--- a/api.c
+++ b/api.c
@@ -158,7 +158,7 @@ static const char SEPARATOR = '|';
#define SEPSTR "|"
static const char GPUSEP = ',';
-static const char *APIVERSION = "1.9";
+static const char *APIVERSION = "1.10";
static const char *DEAD = "Dead";
static const char *SICK = "Sick";
static const char *NOSTART = "NoStart";
@@ -1221,8 +1221,8 @@ static void poolstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
rpc_user = escape_string(pool->rpc_user, isjson);
sprintf(buf, isjson
- ? "%s{\"POOL\":%d,\"URL\":\"%s\",\"Status\":\"%s\",\"Priority\":%d,\"Long Poll\":\"%s\",\"Getworks\":%d,\"Accepted\":%d,\"Rejected\":%d,\"Discarded\":%d,\"Stale\":%d,\"Get Failures\":%d,\"Remote Failures\":%d,\"User\":\"%s\"}"
- : "%sPOOL=%d,URL=%s,Status=%s,Priority=%d,Long Poll=%s,Getworks=%d,Accepted=%d,Rejected=%d,Discarded=%d,Stale=%d,Get Failures=%d,Remote Failures=%d,User=%s" SEPSTR,
+ ? "%s{\"POOL\":%d,\"URL\":\"%s\",\"Status\":\"%s\",\"Priority\":%d,\"Long Poll\":\"%s\",\"Getworks\":%d,\"Accepted\":%d,\"Rejected\":%d,\"Discarded\":%d,\"Stale\":%d,\"Get Failures\":%d,\"Remote Failures\":%d,\"User\":\"%s\",\"Last Share Time\":%lu}"
+ : "%sPOOL=%d,URL=%s,Status=%s,Priority=%d,Long Poll=%s,Getworks=%d,Accepted=%d,Rejected=%d,Discarded=%d,Stale=%d,Get Failures=%d,Remote Failures=%d,User=%s,Last Share Time=%lu" SEPSTR,
(isjson && (i > 0)) ? COMMA : BLANK,
i, rpc_url, status, pool->prio, lp,
pool->getwork_requested,
@@ -1231,7 +1231,7 @@ static void poolstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
pool->stale_shares,
pool->getfail_occasions,
pool->remotefail_occasions,
- rpc_user);
+ rpc_user, pool->last_share_time);
strcat(io_buffer, buf);
diff --git a/cgminer.c b/cgminer.c
index a409797..db8a033 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1660,6 +1660,7 @@ static bool submit_upstream_work(const struct work *work, CURL *curl)
pool->seq_rejects = 0;
cgpu->last_share_pool = pool->pool_no;
cgpu->last_share_pool_time = time(NULL);
+ pool->last_share_time = cgpu->last_share_pool_time;
applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)");
if (!QUIET) {
if (total_pools > 1)
diff --git a/driver-icarus.c b/driver-icarus.c
index 7a7ec49..47b0b16 100644
--- a/driver-icarus.c
+++ b/driver-icarus.c
@@ -72,12 +72,8 @@
// 2 x 11.1 / (5.26 x 10^-9)
//#define ESTIMATE_HASHES 0xFB90365E
-// This is the 8s value but causes hash rate loss
-//#define ESTIMATE_HASHES 0xB54E9147
-
-// TODO: determine why returning any other value when no nonce is found
-// causes hash rate loss
-#define ESTIMATE_HASHES 0xffffffff
+// This is the 8s value
+#define ESTIMATE_HASHES 0xB54E9147
struct device_api icarus_api;
@@ -353,6 +349,7 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
if (opt_debug)
gettimeofday(&tv_finish, NULL);
+ work->blk.nonce = 0xffffffff;
memcpy((char *)&nonce, nonce_bin, sizeof(nonce_bin));
// aborted before becoming idle, get new work
@@ -369,7 +366,6 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
nonce = swab32(nonce);
#endif
- work->blk.nonce = 0xffffffff;
submit_nonce(thr, work, nonce);
if (opt_debug) {
diff --git a/miner.h b/miner.h
index 27decf2..4115cc5 100644
--- a/miner.h
+++ b/miner.h
@@ -645,6 +645,8 @@ struct pool {
int curls;
pthread_cond_t cr_cond;
struct list_head curlring;
+
+ time_t last_share_time;
};
struct work {