Add debugging output to all tq_pop 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
diff --git a/main.c b/main.c
index 04ef5d9..7f99445 100644
--- a/main.c
+++ b/main.c
@@ -1476,6 +1476,9 @@ static void *stage_thread(void *userdata)
while (ok) {
struct work *work = NULL;
+ if (opt_debug)
+ applog(LOG_DEBUG, "Popping work to stage thread");
+
work = tq_pop(mythr->q, NULL);
if (unlikely(!work)) {
applog(LOG_ERR, "Failed to tq_pop in stage_thread");
@@ -1978,6 +1981,9 @@ static void *workio_thread(void *userdata)
while (ok) {
struct workio_cmd *wc;
+ if (opt_debug)
+ applog(LOG_DEBUG, "Popping work to work thread");
+
/* wait for workio_cmd sent to us, on our queue */
wc = tq_pop(mythr->q, NULL);
if (unlikely(!wc)) {
@@ -2267,6 +2273,9 @@ static void discard_staged(void)
gettimeofday(&now, NULL);
abstime.tv_sec = now.tv_sec + 60;
+ if (opt_debug)
+ applog(LOG_DEBUG, "Popping work to discard staged");
+
work_heap = tq_pop(getq, &abstime);
if (unlikely(!work_heap))
return;
@@ -2406,6 +2415,9 @@ retry:
gettimeofday(&now, NULL);
abstime.tv_sec = now.tv_sec + 60;
+ if (opt_debug)
+ applog(LOG_DEBUG, "Popping work from get queue to get work");
+
/* wait for 1st response, or get cached response */
work_heap = tq_pop(getq, &abstime);
if (unlikely(!work_heap)) {
@@ -2907,6 +2919,9 @@ static void *gpuminer_thread(void *userdata)
{ applog(LOG_ERR, "Error: clEnqueueWriteBuffer failed."); goto out; }
mythr->cgpu->alive = true;
+ if (opt_debug)
+ applog(LOG_DEBUG, "Popping ping in gpuminer thread");
+
tq_pop(mythr->q, NULL); /* Wait for a ping to start */
gettimeofday(&tv_workstart, NULL);
/* obtain new work from internal workio thread */
@@ -3033,6 +3048,9 @@ static void *gpuminer_thread(void *userdata)
if (unlikely(!gpu_devices[gpu])) {
applog(LOG_WARNING, "Thread %d being disabled\n", thr_id);
mythr->rolling = mythr->cgpu->rolling = 0;
+ if (opt_debug)
+ applog(LOG_DEBUG, "Popping wakeup ping in gpuminer thread");
+
tq_pop(mythr->q, NULL); /* Ignore ping that's popped */
applog(LOG_WARNING, "Thread %d being re-enabled\n", thr_id);
}
@@ -3105,6 +3123,9 @@ static void *longpoll_thread(void *userdata)
goto out;
}
+ if (opt_debug)
+ applog(LOG_DEBUG, "Popping hdr path in longpoll thread");
+
hdr_path = tq_pop(mythr->q, NULL);
if (!hdr_path) {
applog(LOG_WARNING, "No long-poll found on this server");