Add new best share info to verbose logging.
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
diff --git a/cgminer.c b/cgminer.c
index c6fef3b..507e7ff 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -3204,9 +3204,9 @@ static bool stale_work(struct work *work, bool share)
static uint64_t share_diff(const struct work *work)
{
- uint64_t *data64, d64;
+ uint64_t *data64, d64, ret;
+ bool new_best = false;
char rhash[32];
- uint64_t ret;
swab256(rhash, work->hash);
if (opt_scrypt)
@@ -3219,14 +3219,18 @@ static uint64_t share_diff(const struct work *work)
ret = diffone / d64;
cg_wlock(&control_lock);
- if (ret > best_diff) {
+ if (unlikely(ret > best_diff)) {
+ new_best = true;
best_diff = ret;
suffix_string(best_diff, best_share, 0);
}
- if (ret > work->pool->best_diff)
+ if (unlikely(ret > work->pool->best_diff))
work->pool->best_diff = ret;
cg_wunlock(&control_lock);
+ if (unlikely(new_best))
+ applog(LOG_INFO, "New best share: %s", best_share);
+
return ret;
}