Browse Source

clean extra logs, show bloc height on new jobs

master
Tanguy Pruvot 10 years ago
parent
commit
2ebfb546a6
  1. 2
      configure.sh
  2. 17
      cpu-miner.c
  3. 4
      hashlog.cpp
  4. 1
      miner.h
  5. 3
      util.c

2
configure.sh

@ -5,5 +5,5 @@ @@ -5,5 +5,5 @@
#--ptxas-options=\"-v -dlcm=cg\""
CUDA_CFLAGS="-O3" ./configure "CFLAGS=-O3" "CXXFLAGS=-O3" --with-cuda=/usr/local/cuda
CUDA_CFLAGS="-O2" ./configure "CFLAGS=-O2" "CXXFLAGS=-O2" --with-cuda=/usr/local/cuda

17
cpu-miner.c

@ -918,9 +918,9 @@ static void *miner_thread(void *userdata) @@ -918,9 +918,9 @@ static void *miner_thread(void *userdata)
g_work_time = time(NULL);
}
}
if (memcmp(work.data, g_work.data, 72)) { // wcmplen)) {
if (memcmp(work.data, g_work.data, wcmplen)) {
if (opt_debug) {
applog(LOG_DEBUG, "job %s %08x work updated", g_work.job_id, (*nonceptr));
applog(LOG_DEBUG, "job %s work updated", g_work.job_id);
for (int n=0; n<wcmplen; n+=8) {
if (memcmp(work.data + n, g_work.data + n, 8)) {
applog(LOG_DEBUG, "diff detected at offset %d", n);
@ -933,7 +933,7 @@ static void *miner_thread(void *userdata) @@ -933,7 +933,7 @@ static void *miner_thread(void *userdata)
(*nonceptr) = (0xffffffffUL / opt_n_threads) * thr_id; // 0 if single thr
} else if (memcmp(work.target, g_work.target, sizeof(work.target))) {
if (opt_debug) {
applog(LOG_DEBUG, "job %s %08x target change", g_work.job_id, (*nonceptr));
applog(LOG_DEBUG, "job %s target change", g_work.job_id);
applog_hash((uint8_t*) work.target);
applog_hash((uint8_t*) g_work.target);
}
@ -944,7 +944,8 @@ static void *miner_thread(void *userdata) @@ -944,7 +944,8 @@ static void *miner_thread(void *userdata)
pthread_mutex_unlock(&g_work_lock);
work_restart[thr_id].restart = 0;
applog(LOG_WARNING, "job %s %08x", g_work.job_id, (*nonceptr));
if (opt_debug)
applog(LOG_WARNING, "job %s %08x", g_work.job_id, (*nonceptr));
/* adjust max_nonce to meet target scan time */
if (have_stratum)
@ -1328,16 +1329,20 @@ static void *stratum_thread(void *userdata) @@ -1328,16 +1329,20 @@ static void *stratum_thread(void *userdata)
}
if (stratum.job.job_id &&
(strcmp(stratum.job.job_id, g_work.job_id) || !g_work_time)) {
(!g_work_time || strncmp(stratum.job.job_id, g_work.job_id + 8, 120))) {
pthread_mutex_lock(&g_work_lock);
stratum_gen_work(&stratum, &g_work);
time(&g_work_time);
pthread_mutex_unlock(&g_work_lock);
if (stratum.job.clean) {
if (!opt_quiet)
applog(LOG_BLUE, "%s send a new %s job", short_url, algo_names[opt_algo]);
applog(LOG_BLUE, "%s requested %s job %d restart, block %d", short_url, algo_names[opt_algo],
strtoul(stratum.job.job_id, NULL, 16), stratum.bloc_height);
restart_threads();
hashlog_purge_old();
} else if (!opt_quiet) {
applog(LOG_BLUE, "%s send %s job %d, block %d", short_url, algo_names[opt_algo],
strtoul(stratum.job.job_id, NULL, 16), stratum.bloc_height);
}
}

4
hashlog.cpp

@ -101,8 +101,8 @@ extern "C" void hashlog_remember_scan_range(char* jobid, uint32_t scanned_from, @@ -101,8 +101,8 @@ extern "C" void hashlog_remember_scan_range(char* jobid, uint32_t scanned_from,
data.tm_upd = (uint32_t) time(NULL);
tlastshares[keyall] = data;
applog(LOG_BLUE, "job %s range : %x %x -> %x %x", jobid,
scanned_from, scanned_to, data.scanned_from, data.scanned_to);/* */
/* applog(LOG_BLUE, "job %s range : %x %x -> %x %x", jobid,
scanned_from, scanned_to, data.scanned_from, data.scanned_to); */
}
/**

1
miner.h

@ -380,6 +380,7 @@ struct stratum_ctx { @@ -380,6 +380,7 @@ struct stratum_ctx {
pthread_mutex_t work_lock;
int srvtime_diff;
int bloc_height;
};
bool stratum_socket_full(struct stratum_ctx *sctx, int timeout);

3
util.c

@ -1069,10 +1069,13 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params) @@ -1069,10 +1069,13 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params)
coinb2_size = strlen(coinb2) / 2;
sctx->job.coinbase_size = coinb1_size + sctx->xnonce1_size +
sctx->xnonce2_size + coinb2_size;
sctx->job.coinbase = (unsigned char*)realloc(sctx->job.coinbase, sctx->job.coinbase_size);
sctx->job.xnonce2 = sctx->job.coinbase + coinb1_size + sctx->xnonce1_size;
hex2bin(sctx->job.coinbase, coinb1, coinb1_size);
memcpy(sctx->job.coinbase + coinb1_size, sctx->xnonce1, sctx->xnonce1_size);
sctx->bloc_height = le16dec((uint8_t*) sctx->job.coinbase + 43);
if (!sctx->job.job_id || strcmp(sctx->job.job_id, job_id))
memset(sctx->job.xnonce2, 0, sctx->xnonce2_size);
hex2bin(sctx->job.xnonce2 + sctx->xnonce2_size, coinb2, coinb2_size);

Loading…
Cancel
Save