Browse Source

Track pool number.

nfactor-troky
Con Kolivas 14 years ago
parent
commit
d518f7cbfd
  1. 28
      main.c
  2. 1
      miner.h

28
main.c

@ -210,16 +210,18 @@ static void applog_and_exit(const char *fmt, ...)
static void add_pool(void) static void add_pool(void)
{ {
int poolno;
struct pool *pool; struct pool *pool;
total_pools++; poolno = total_pools++;
pools = realloc(pools, sizeof(struct pool) * total_pools); pools = realloc(pools, sizeof(struct pool) * total_pools);
if (!pools) { if (!pools) {
applog(LOG_ERR, "Failed to malloc pools in add_pool"); applog(LOG_ERR, "Failed to malloc pools in add_pool");
exit (1); exit (1);
} }
pool = &pools[total_pools - 1]; pool = &pools[poolno];
memset(pool, 0, sizeof(struct pool)); memset(pool, 0, sizeof(struct pool));
pool->pool_no = poolno;
if (unlikely(pthread_mutex_init(&pool->pool_lock, NULL))) { if (unlikely(pthread_mutex_init(&pool->pool_lock, NULL))) {
applog(LOG_ERR, "Failed to pthread_mutex_init in add_pool"); applog(LOG_ERR, "Failed to pthread_mutex_init in add_pool");
exit (1); exit (1);
@ -822,18 +824,28 @@ static bool submit_upstream_work(const struct work *work)
pool->accepted++; pool->accepted++;
if (opt_debug) if (opt_debug)
applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)"); applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)");
if (!opt_quiet) if (!opt_quiet) {
applog(LOG_WARNING, "Share %.8s accepted from %sPU %d thread %d", if (total_pools > 1)
hexstr + 152, cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, thr_id); 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 { } else {
cgpu->rejected++; cgpu->rejected++;
total_rejected++; total_rejected++;
pool->rejected++; pool->rejected++;
if (opt_debug) if (opt_debug)
applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)"); applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)");
if (!opt_quiet) if (!opt_quiet) {
applog(LOG_WARNING, "Share %.8s rejected from %sPU %d thread %d", if (total_pools > 1)
hexstr + 152, cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, thr_id); 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; cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60;

1
miner.h

@ -266,6 +266,7 @@ typedef struct {
#endif #endif
struct pool { struct pool {
int pool_no;
int accepted, rejected; int accepted, rejected;
bool submit_fail; bool submit_fail;
bool localgen; bool localgen;

Loading…
Cancel
Save