Changeset: 7bebb96fa22c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7bebb96fa22c
Modified Files:
        MonetDB5/mal/mal_dataflow.c
        MonetDB5/mal/mal_interpreter.h
Branch: tracer
Log Message:

Revert "Restored commit 71062:892628a7f632"

This reverts commit 0ae2e50abde29eb6bc68a6b835559908000d029f.


diffs (149 lines):

diff --git a/MonetDB5/mal/mal_dataflow.c b/MonetDB5/mal/mal_dataflow.c
--- a/MonetDB5/mal/mal_dataflow.c
+++ b/MonetDB5/mal/mal_dataflow.c
@@ -336,10 +336,12 @@ DFLOWworker(void *T)
        srand((unsigned int) GDKusec());
 #endif
        GDKsetbuf(GDKmalloc(GDKMAXERRLEN)); /* where to leave errors */
-       if( GDKerrbuf == 0)
-               fprintf(stderr,"DFLOWworker:Could not allocate GDKerrbuf\n");
-       else
+       if( GDKerrbuf == 0) {
+               CRITICAL(M_ALL, "Could not allocate GDKerrbuf\n");
+       } else {
                GDKclrerr();
+       }
+               
        cntxt = ATOMIC_PTR_GET(&t->cntxt);
        if (cntxt) {
                /* wait until we are allowed to start working */
@@ -397,8 +399,8 @@ DFLOWworker(void *T)
                }
 #endif
                error = runMALsequence(flow->cntxt, flow->mb, fe->pc, fe->pc + 
1, flow->stk, 0, 0);
-               PARDEBUG fprintf(stderr, "#executed pc= %d wrk= %d claim= " 
LLFMT "," LLFMT "," LLFMT " %s\n",
-                                                fe->pc, id, fe->argclaim, 
fe->hotclaim, fe->maxclaim, error ? error : "");
+               DEBUG(PAR, "Executed pc=%d wrk=%d claim=" LLFMT "," LLFMT "," 
LLFMT " %s\n",
+                                       fe->pc, id, fe->argclaim, fe->hotclaim, 
fe->maxclaim, error ? error : "");
 #ifdef USE_MAL_ADMISSION
                /* release the memory claim */
                MALadmission(-fe->argclaim, -fe->hotclaim);
@@ -553,7 +555,7 @@ DFLOWinitBlk(DataFlow flow, MalBlkPtr mb
                throw(MAL, "dataflow", "DFLOWinitBlk(): Called with flow == 
NULL");
        if (mb == NULL)
                throw(MAL, "dataflow", "DFLOWinitBlk(): Called with mb == 
NULL");
-       PARDEBUG fprintf(stderr, "#Initialize dflow block\n");
+       DEBUG(PAR, "Initialize dflow block\n");
        assign = (int *) GDKzalloc(mb->vtop * sizeof(int));
        if (assign == NULL)
                throw(MAL, "dataflow", SQLSTATE(HY001) MAL_MALLOC_FAIL);
@@ -621,7 +623,7 @@ DFLOWinitBlk(DataFlow flow, MalBlkPtr mb
                                l = getEndScope(mb, getArg(p, j));
                                if (l != pc && l < flow->stop && l > 
flow->start) {
                                        /* add edge to the target instruction 
for wakeup call */
-                                       PARDEBUG fprintf(stderr, "#endoflife 
for %s is %d -> %d\n", getVarName(mb, getArg(p, j)), n + flow->start, l);
+                                       DEBUG(PAR, "Endoflife for %s is %d -> 
%d\n", getVarName(mb, getArg(p, j)), n + flow->start, l);
                                        assert(pc < l); /* only dependencies on 
earlier instructions */
                                        l -= flow->start;
                                        if (flow->nodes[n]) {
@@ -663,19 +665,18 @@ DFLOWinitBlk(DataFlow flow, MalBlkPtr mb
                        assign[getArg(p, j)] = pc;  /* ensure recognition of 
dependency on first instruction and constant */
        }
        GDKfree(assign);
-       PARDEBUG {
-               for (n = 0; n < flow->stop - flow->start; n++) {
-                       fprintf(stderr, "#[%d] %d: ", flow->start + n, n);
-                       fprintInstruction(MAL_DATAFLOW, mb, 0, getInstrPtr(mb, 
n + flow->start), LIST_MAL_ALL);
-                       fprintf(stderr, "#[%d]Dependents block count %d 
wakeup", flow->start + n, flow->status[n].blocks);
-                       for (j = n; flow->edges[j]; j = flow->edges[j]) {
-                               fprintf(stderr, "%d ", flow->start + 
flow->nodes[j]);
-                               if (flow->edges[j] == -1)
-                                       break;
-                       }
-                       fprintf(stderr, "\n");
+
+       for (n = 0; n < flow->stop - flow->start; n++) {
+               DEBUG(PAR, "[%d] %d\n", flow->start + n, n);
+               fprintInstruction(PAR, mb, 0, getInstrPtr(mb, n + flow->start), 
LIST_MAL_ALL);
+               DEBUG(PAR, "[%d] dependents block count %d wakeup\n", 
flow->start + n, flow->status[n].blocks);
+               for (j = n; flow->edges[j]; j = flow->edges[j]) {
+                       DEBUG(PAR, "%d\n", flow->start + flow->nodes[j]);
+                       if (flow->edges[j] == -1)
+                               break;
                }
        }
+
 #ifdef USE_MAL_ADMISSION
        memorypool = memoryclaims = 0;
 #endif
@@ -697,10 +698,10 @@ static void showFlowEvent(DataFlow flow,
        int i;
        FlowEvent fe = flow->status;
 
-       fprintf(stderr, "#end of data flow %d done %d \n", pc, flow->stop - 
flow->start);
+       INFO(MAL_ALL, "End of data flow '%d' done '%d'\n", pc, flow->stop - 
flow->start);
        for (i = 0; i < flow->stop - flow->start; i++)
                if (fe[i].state != DFLOWwrapup && fe[i].pc >= 0) {
-                       fprintf(stderr, "#missed pc %d status %d %d  blocks 
%d", fe[i].state, i, fe[i].pc, fe[i].blocks);
+                       INFO(MAL_ALL, "Missed pc %d status %d %d blocks %d\n", 
fe[i].state, i, fe[i].pc, fe[i].blocks);
                        fprintInstruction(MAL_DATAFLOW, fe[i].flow->mb, 0, 
getInstrPtr(fe[i].flow->mb, fe[i].pc), LIST_MAL_MAPI);
                }
 }
@@ -741,12 +742,11 @@ DFLOWscheduler(DataFlow flow, struct wor
 #endif
                        q_enqueue(todo, flow->status + i);
                        flow->status[i].state = DFLOWrunning;
-                       PARDEBUG fprintf(stderr, "#enqueue pc=%d claim=" LLFMT 
"\n", flow->status[i].pc, flow->status[i].argclaim);
+                       DEBUG(PAR, "Enqueue pc=%d claim=" LLFMT "\n", 
flow->status[i].pc, flow->status[i].argclaim);
                }
        MT_lock_unset(&flow->flowlock);
        MT_sema_up(&w->s);
-
-       PARDEBUG fprintf(stderr, "#run %d instructions in dataflow block\n", 
actions);
+       DEBUG(PAR, "Run '%d' instructions in dataflow block\n", actions);
 
        while (actions != tasks ) {
                f = q_dequeue(flow->done, NULL);
@@ -770,7 +770,7 @@ DFLOWscheduler(DataFlow flow, struct wor
                                        flow->status[i].state = DFLOWrunning;
                                        flow->status[i].blocks--;
                                        q_enqueue(todo, flow->status + i);
-                                       PARDEBUG fprintf(stderr, "#enqueue 
pc=%d claim= " LLFMT "\n", flow->status[i].pc, flow->status[i].argclaim);
+                                       DEBUG(PAR, "Enqueue pc=%d claim=" LLFMT 
"\n", flow->status[i].pc, flow->status[i].argclaim);
                                } else {
                                        flow->status[i].blocks--;
                                }
@@ -783,7 +783,7 @@ DFLOWscheduler(DataFlow flow, struct wor
        /* wrap up errors */
        assert(flow->done->last == 0);
        if ((ret = ATOMIC_PTR_XCG(&flow->error, NULL)) != NULL ) {
-               PARDEBUG fprintf(stderr, "#errors encountered %s ", ret);
+               DEBUG(PAR, "Errors encountered: %s\n", ret);
        }
        return ret;
 }
@@ -811,10 +811,8 @@ runMALdataflow(Client cntxt, MalBlkPtr m
        bit *ret;
        int i;
 
-#ifdef DEBUG_FLOW
-       fprintf(stderr, "#runMALdataflow for block %d - %d\n", startpc, stoppc);
-       fprintFunction(MAL_DATAFLOW, mb, 0, LIST_ALL);
-#endif
+       DEBUG(MAL_DATAFLOW, "Running for block: %d - %d\n", startpc, stoppc);
+       fprintFunction(MAL_DATAFLOW, mb, 0, LIST_MAL_ALL);
 
        /* in debugging mode we should not start multiple threads */
        if (stk == NULL)
diff --git a/MonetDB5/mal/mal_interpreter.h b/MonetDB5/mal/mal_interpreter.h
--- a/MonetDB5/mal/mal_interpreter.h
+++ b/MonetDB5/mal/mal_interpreter.h
@@ -23,8 +23,6 @@
  * to be passed by a handle.
  */
 
-/* #define DEBUG_FLOW */
-
 mal_export MalStkPtr prepareMALstack(MalBlkPtr mb, int size);
 mal_export str runMAL(Client c, MalBlkPtr mb, MalBlkPtr mbcaller, MalStkPtr 
env);
 mal_export str runMALsequence(Client cntxt, MalBlkPtr mb, int startpc, int 
stoppc, MalStkPtr stk, MalStkPtr env, InstrPtr pcicaller);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to