aboutsummaryrefslogtreecommitdiff
path: root/src/util/scheduler.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-02-26 14:21:49 +0000
committerChristian Grothoff <christian@grothoff.org>2012-02-26 14:21:49 +0000
commit34961f382d98822d1fa3506e8bfdf163e2e915ea (patch)
tree855ac5770b741da80fc8c2fff1bfb283913e9685 /src/util/scheduler.c
parent3d97cc0d1b93fd0ee2deb2440b3c3a59bfa506ed (diff)
downloadgnunet-34961f382d98822d1fa3506e8bfdf163e2e915ea.tar.gz
gnunet-34961f382d98822d1fa3506e8bfdf163e2e915ea.zip
-some more #if DEBUG elimination
Diffstat (limited to 'src/util/scheduler.c')
-rw-r--r--src/util/scheduler.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index 412896946..f1cecd4ef 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -30,14 +30,15 @@
30#include "gnunet_signal_lib.h" 30#include "gnunet_signal_lib.h"
31#include "gnunet_time_lib.h" 31#include "gnunet_time_lib.h"
32#include "disk.h" 32#include "disk.h"
33#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
34 33
35#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) 34#define LOG(kind,...) GNUNET_log_from (kind, "util-scheduler", __VA_ARGS__)
36#ifdef LINUX
37#include "execinfo.h"
38 35
36#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-scheduler", syscall)
39 37
40 38
39#ifdef LINUX
40#include "execinfo.h"
41
41/** 42/**
42 * Use lsof to generate file descriptor reports on select error? 43 * Use lsof to generate file descriptor reports on select error?
43 * (turn off for stable releases). 44 * (turn off for stable releases).
@@ -52,7 +53,7 @@
52/** 53/**
53 * Check each file descriptor before adding 54 * Check each file descriptor before adding
54 */ 55 */
55#define DEBUG_FDS GNUNET_EXTRA_LOGGING 56#define DEBUG_FDS GNUNET_NO
56 57
57/** 58/**
58 * Depth of the traces collected via EXECINFO. 59 * Depth of the traces collected via EXECINFO.
@@ -60,8 +61,6 @@
60#define MAX_TRACE_DEPTH 50 61#define MAX_TRACE_DEPTH 50
61#endif 62#endif
62 63
63#define DEBUG_TASKS GNUNET_EXTRA_LOGGING
64
65/** 64/**
66 * Should we figure out which tasks are delayed for a while 65 * Should we figure out which tasks are delayed for a while
67 * before they are run? (Consider using in combination with EXECINFO). 66 * before they are run? (Consider using in combination with EXECINFO).
@@ -74,6 +73,7 @@
74 */ 73 */
75#define DELAY_THRESHOLD GNUNET_TIME_UNIT_SECONDS 74#define DELAY_THRESHOLD GNUNET_TIME_UNIT_SECONDS
76 75
76
77/** 77/**
78 * Linked list of pending tasks. 78 * Linked list of pending tasks.
79 */ 79 */
@@ -526,10 +526,9 @@ check_ready (const struct GNUNET_NETWORK_FDSet *rs,
526 pos = pending; 526 pos = pending;
527 while (pos != NULL) 527 while (pos != NULL)
528 { 528 {
529#if DEBUG_TASKS 529 LOG (GNUNET_ERROR_TYPE_DEBUG,
530 LOG (GNUNET_ERROR_TYPE_DEBUG, "Checking readiness of task: %llu / %p\n", 530 "Checking readiness of task: %llu / %p\n",
531 pos->id, pos->callback_cls); 531 pos->id, pos->callback_cls);
532#endif
533 next = pos->next; 532 next = pos->next;
534 if (GNUNET_YES == is_ready (pos, now, rs, ws)) 533 if (GNUNET_YES == is_ready (pos, now, rs, ws))
535 { 534 {
@@ -677,10 +676,9 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws)
677 (pos->write_fd != -1) && 676 (pos->write_fd != -1) &&
678 (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd))) 677 (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd)))
679 GNUNET_abort (); // added to ready in previous select loop! 678 GNUNET_abort (); // added to ready in previous select loop!
680#if DEBUG_TASKS 679 LOG (GNUNET_ERROR_TYPE_DEBUG,
681 LOG (GNUNET_ERROR_TYPE_DEBUG, "Running task: %llu / %p\n", pos->id, 680 "Running task: %llu / %p\n", pos->id,
682 pos->callback_cls); 681 pos->callback_cls);
683#endif
684 pos->callback (pos->callback_cls, &tc); 682 pos->callback (pos->callback_cls, &tc);
685#if EXECINFO 683#if EXECINFO
686 int i; 684 int i;
@@ -1037,10 +1035,8 @@ GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_TaskIdentifier task)
1037 prev->next = t->next; 1035 prev->next = t->next;
1038 } 1036 }
1039 ret = t->callback_cls; 1037 ret = t->callback_cls;
1040#if DEBUG_TASKS
1041 LOG (GNUNET_ERROR_TYPE_DEBUG, "Canceling task: %llu / %p\n", task, 1038 LOG (GNUNET_ERROR_TYPE_DEBUG, "Canceling task: %llu / %p\n", task,
1042 t->callback_cls); 1039 t->callback_cls);
1043#endif
1044 destroy_task (t); 1040 destroy_task (t);
1045 return ret; 1041 return ret;
1046} 1042}
@@ -1087,10 +1083,8 @@ GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task, voi
1087 t->reason = reason; 1083 t->reason = reason;
1088 t->priority = priority; 1084 t->priority = priority;
1089 t->lifeness = current_lifeness; 1085 t->lifeness = current_lifeness;
1090#if DEBUG_TASKS
1091 LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding continuation task: %llu / %p\n", t->id, 1086 LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding continuation task: %llu / %p\n", t->id,
1092 t->callback_cls); 1087 t->callback_cls);
1093#endif
1094 queue_ready_task (t); 1088 queue_ready_task (t);
1095} 1089}
1096 1090
@@ -1233,10 +1227,8 @@ GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay,
1233 /* hyper-optimization... */ 1227 /* hyper-optimization... */
1234 pending_timeout_last = t; 1228 pending_timeout_last = t;
1235 1229
1236#if DEBUG_TASKS
1237 LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding task: %llu / %p\n", t->id, 1230 LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding task: %llu / %p\n", t->id,
1238 t->callback_cls); 1231 t->callback_cls);
1239#endif
1240#if EXECINFO 1232#if EXECINFO
1241 int i; 1233 int i;
1242 1234
@@ -1416,10 +1408,8 @@ add_without_sets (struct GNUNET_TIME_Relative delay,
1416 t->next = pending; 1408 t->next = pending;
1417 pending = t; 1409 pending = t;
1418 max_priority_added = GNUNET_MAX (max_priority_added, t->priority); 1410 max_priority_added = GNUNET_MAX (max_priority_added, t->priority);
1419#if DEBUG_TASKS
1420 LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding task: %llu / %p\n", t->id, 1411 LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding task: %llu / %p\n", t->id,
1421 t->callback_cls); 1412 t->callback_cls);
1422#endif
1423#if EXECINFO 1413#if EXECINFO
1424 int i; 1414 int i;
1425 1415
@@ -1693,10 +1683,8 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
1693 t->next = pending; 1683 t->next = pending;
1694 pending = t; 1684 pending = t;
1695 max_priority_added = GNUNET_MAX (max_priority_added, t->priority); 1685 max_priority_added = GNUNET_MAX (max_priority_added, t->priority);
1696#if DEBUG_TASKS
1697 LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding task: %llu / %p\n", t->id, 1686 LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding task: %llu / %p\n", t->id,
1698 t->callback_cls); 1687 t->callback_cls);
1699#endif
1700#if EXECINFO 1688#if EXECINFO
1701 int i; 1689 int i;
1702 1690