1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-27 15:04:17 +00:00

Track pool number.

This commit is contained in:
Con Kolivas 2011-07-20 10:24:25 +10:00
parent 02e0e12529
commit d518f7cbfd
2 changed files with 21 additions and 8 deletions

28
main.c
View File

@ -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;

View File

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