From d518f7cbfd71f9f1f1dd1ff1853d79782f04a019 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 20 Jul 2011 10:24:25 +1000 Subject: [PATCH] Track pool number. --- main.c | 28 ++++++++++++++++++++-------- miner.h | 1 + 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index 37d53069..1417296e 100644 --- a/main.c +++ b/main.c @@ -210,16 +210,18 @@ static void applog_and_exit(const char *fmt, ...) static void add_pool(void) { + int poolno; struct pool *pool; - total_pools++; + poolno = total_pools++; pools = realloc(pools, sizeof(struct pool) * total_pools); if (!pools) { applog(LOG_ERR, "Failed to malloc pools in add_pool"); exit (1); } - pool = &pools[total_pools - 1]; + pool = &pools[poolno]; memset(pool, 0, sizeof(struct pool)); + pool->pool_no = poolno; if (unlikely(pthread_mutex_init(&pool->pool_lock, NULL))) { applog(LOG_ERR, "Failed to pthread_mutex_init in add_pool"); exit (1); @@ -822,18 +824,28 @@ static bool submit_upstream_work(const struct work *work) pool->accepted++; if (opt_debug) applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)"); - if (!opt_quiet) - applog(LOG_WARNING, "Share %.8s accepted from %sPU %d thread %d", - hexstr + 152, cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, thr_id); + if (!opt_quiet) { + if (total_pools > 1) + applog(LOG_WARNING, "Accepted %.8s %sPU %d thread %d pool %d", + hexstr + 152, cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, thr_id, work->pool->pool_no); + else + applog(LOG_WARNING, "Accepted %.8s %sPU %d thread %d", + hexstr + 152, cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, thr_id); + } } else { cgpu->rejected++; total_rejected++; pool->rejected++; if (opt_debug) applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)"); - if (!opt_quiet) - applog(LOG_WARNING, "Share %.8s rejected from %sPU %d thread %d", - hexstr + 152, cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, thr_id); + if (!opt_quiet) { + if (total_pools > 1) + applog(LOG_WARNING, "Rejected %.8s %sPU %d thread %d pool %d", + hexstr + 152, cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, thr_id, work->pool->pool_no); + else + applog(LOG_WARNING, "Rejected %.8s %sPU %d thread %d", + hexstr + 152, cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, thr_id); + } } cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60; diff --git a/miner.h b/miner.h index 238b8b5f..089ccd55 100644 --- a/miner.h +++ b/miner.h @@ -266,6 +266,7 @@ typedef struct { #endif struct pool { + int pool_no; int accepted, rejected; bool submit_fail; bool localgen;