Add debugging output to tq_push calls.
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
diff --git a/main.c b/main.c
index b860765..04ef5d9 100644
--- a/main.c
+++ b/main.c
@@ -925,7 +925,7 @@ static bool submit_upstream_work(const struct work *work)
hexstr);
if (opt_debug)
- applog(LOG_DEBUG, "DBG: sending RPC call: %s", s);
+ applog(LOG_DEBUG, "DBG: sending %s submit RPC call: %s", pool->rpc_url, s);
/* issue JSON-RPC request */
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, s, false, false, pool);
@@ -1036,6 +1036,9 @@ static bool get_upstream_work(struct work *work, bool lagging)
}
pool = select_pool(lagging);
+ if (opt_debug)
+ applog(LOG_DEBUG, "DBG: sending %s get RPC call: %s", pool->rpc_url, rpc_req);
+
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req,
want_longpoll, false, pool);
if (unlikely(!val)) {
@@ -1140,6 +1143,9 @@ void kill_work(void)
wc->cmd = WC_DIE;
wc->thr = 0;
+ if (opt_debug)
+ applog(LOG_DEBUG, "Pushing die request to work thread");
+
if (unlikely(!tq_push(thr_info[work_thr_id].q, wc))) {
applog(LOG_ERR, "Failed to tq_push work in kill_work");
exit (1);
@@ -1183,6 +1189,9 @@ static void *get_work_thread(void *userdata)
sleep(opt_fail_pause);
}
+ if (opt_debug)
+ applog(LOG_DEBUG, "Pushing work to requesting thread");
+
/* send work to requesting thread */
if (unlikely(!tq_push(thr_info[stage_thr_id].q, ret_work))) {
applog(LOG_ERR, "Failed to tq_push work in workio_get_work");
@@ -1478,6 +1487,9 @@ static void *stage_thread(void *userdata)
if (!work->cloned && !work->clone)
gettimeofday(&work->tv_staged, NULL);
+ if (opt_debug)
+ applog(LOG_DEBUG, "Pushing work to getwork queue");
+
if (unlikely(!tq_push(getq, work))) {
applog(LOG_ERR, "Failed to tq_push work in stage_thread");
ok = false;
@@ -1895,6 +1907,9 @@ retry:
if (dev_from_id(i) != selected)
continue;
thr = &thr_info[i];
+ if (opt_debug)
+ applog(LOG_DEBUG, "Pushing ping to thread %d", thr->id);
+
tq_push(thr->q, &ping);
}
} if (!strncasecmp(&input, "d", 1)) {
@@ -2143,6 +2158,9 @@ static bool pool_active(struct pool *pool)
applog(LOG_DEBUG, "Successfully retrieved and deciphered work from pool %u %s",
pool->pool_no, pool->rpc_url);
work->pool = pool;
+ if (opt_debug)
+ applog(LOG_DEBUG, "Pushing pooltest work to base pool");
+
tq_push(thr_info[stage_thr_id].q, work);
total_getworks++;
pool->getwork_requested++;
@@ -2210,6 +2228,9 @@ static bool queue_request(void)
if (rq > (maxq * 2 / 3) && !rs)
wc->lagging = true;
+ if (opt_debug)
+ applog(LOG_DEBUG, "Queueing getwork request to work thread");
+
/* send work request to workio thread */
if (unlikely(!tq_push(thr_info[work_thr_id].q, wc))) {
applog(LOG_ERR, "Failed to tq_push in queue_request");
@@ -2413,6 +2434,9 @@ retry:
* should we divide the same work up again. Make the work we're
* handing out be clone */
if (divide_work(&now, work_heap, hash_div)) {
+ if (opt_debug)
+ applog(LOG_DEBUG, "Pushing divided work to get queue head");
+
tq_push_head(getq, work_heap);
work->clone = true;
} else {
@@ -2458,6 +2482,9 @@ static bool submit_work_sync(struct thr_info *thr, const struct work *work_in)
wc->thr = thr;
memcpy(wc->u.work, work_in, sizeof(*work_in));
+ if (opt_debug)
+ applog(LOG_DEBUG, "Pushing submit work to work thread");
+
/* send solution to workio thread */
if (unlikely(!tq_push(thr_info[work_thr_id].q, wc))) {
applog(LOG_ERR, "Failed to tq_push work in submit_work_sync");
@@ -2931,6 +2958,8 @@ static void *gpuminer_thread(void *userdata)
memset(res, 0, BUFFERSIZE);
gettimeofday(&tv_workstart, NULL);
+ if (opt_debug)
+ applog(LOG_DEBUG, "getwork thread %d", thr_id);
/* obtain new work from internal workio thread */
if (unlikely(!get_work(work, requested, mythr, thr_id, hash_div))) {
applog(LOG_ERR, "work retrieval failed, exiting "
@@ -2943,8 +2972,6 @@ static void *gpuminer_thread(void *userdata)
precalc_hash(&work->blk, (uint32_t *)(work->midstate), (uint32_t *)(work->data + 64));
work_restart[thr_id].restart = 0;
- if (opt_debug)
- applog(LOG_DEBUG, "getwork thread %d", thr_id);
/* Flushes the writebuffer set with CL_FALSE above */
clFinish(clState->commandQueue);
}
@@ -3052,6 +3079,9 @@ static void convert_to_work(json_t *val)
}
work->pool = current_pool();
+ if (opt_debug)
+ applog(LOG_DEBUG, "Pushing converted work to stage thread");
+
if (unlikely(!tq_push(thr_info[stage_thr_id].q, work)))
applog(LOG_ERR, "Could not tq_push work in convert_to_work");
else if (opt_debug)
@@ -3255,6 +3285,9 @@ static void *reinit_gpu(void *userdata)
}
/* Try to re-enable it */
gpu_devices[gpu] = true;
+ if (opt_debug)
+ applog(LOG_DEBUG, "Pushing ping to thread %d", thr_id);
+
tq_push(thr->q, &ping);
applog(LOG_WARNING, "Thread %d restarted", thr_id);
@@ -3799,8 +3832,12 @@ int main (int argc, char *argv[])
/* Enable threads for devices set not to mine but disable
* their queue in case we wish to enable them later*/
- if (gpu_devices[gpu])
+ if (gpu_devices[gpu]) {
+ if (opt_debug)
+ applog(LOG_DEBUG, "Pushing ping to thread %d", thr->id);
+
tq_push(thr->q, &ping);
+ }
applog(LOG_INFO, "Init GPU thread %i", i);
clStates[i] = initCl(gpu, name, sizeof(name));