10 #ifdef ABT_CONFIG_USE_DEBUG_LOG
12 void ABTI_log_debug(
const char *format, ...)
19 const char *prefix_fmt = NULL, *prefix = NULL;
20 char static_buffer[256], *newfmt;
26 if (p_local_xstream) {
29 if (p_ythread == NULL) {
31 prefix_fmt =
"<U%" PRIu64
":E%d> %s";
32 rank = p_local_xstream->
rank;
39 rank = p_local_xstream->
rank;
40 prefix_fmt =
"<U%" PRIu64
":E%d> %s";
50 const int len_tid_rank = 50;
51 newfmt_len = 6 + len_tid_rank + strlen(format);
52 if (
sizeof(static_buffer) >= newfmt_len + 1) {
53 newfmt = static_buffer;
55 int abt_errno =
ABTU_malloc(newfmt_len + 1, (
void **)&newfmt);
59 sprintf(newfmt, prefix_fmt, tid, rank, format);
61 newfmt_len = strlen(prefix) + strlen(format);
62 if (
sizeof(static_buffer) >= newfmt_len + 1) {
63 newfmt = static_buffer;
65 int abt_errno =
ABTU_malloc(newfmt_len + 1, (
void **)&newfmt);
69 sprintf(newfmt, prefix_fmt, prefix, format);
72 #ifndef ABT_CONFIG_USE_DEBUG_LOG_DISCARD
74 va_start(list, format);
75 vfprintf(stderr, newfmt, list);
83 if (newfmt != static_buffer) {
88 void ABTI_log_debug_thread(
const char *msg,
ABTI_thread *p_thread)
92 ABTI_log_debug(
"%s [unknown ULT]\n", msg);
97 ABTI_log_debug(
"%s U%" PRIu64
" (primary)\n", msg,
101 ABTI_log_debug(
"%s U%" PRIu64
" (main sched)\n", msg,
123 ABTI_log_debug(
"[%c%" PRIu64
":E%d] pushed to P%" PRIu64
"\n",
127 ABTI_log_debug(
"[%c%" PRIu64
"] pushed to P%" PRIu64
"\n", unit_type,
143 ABTI_log_debug(
"[%c%" PRIu64
":E%d] removed from P%" PRIu64
"\n",
147 ABTI_log_debug(
"[%c%" PRIu64
"] removed from P%" PRIu64
"\n", unit_type,
163 ABTI_log_debug(
"[%c%" PRIu64
":E%d] popped from P%" PRIu64
"\n",
167 ABTI_log_debug(
"[%c%" PRIu64
"] popped from P%" PRIu64
"\n", unit_type,
176 for (i = 0; i < num; i++) {
177 ABTI_log_pool_pop(p_pool, threads[i]);
185 for (i = 0; i < num; i++) {
186 ABTI_log_pool_push(p_pool, units[i]);