Changeset: 2fab7ecc717e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2fab7ecc717e Modified Files: monetdb5/mal/mal_dataflow.c monetdb5/mal/mal_interpreter.h Branch: tracer Log Message:
Restored commit 71062:892628a7f632 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,12 +336,10 @@ DFLOWworker(void *T) srand((unsigned int) GDKusec()); #endif GDKsetbuf(GDKmalloc(GDKMAXERRLEN)); /* where to leave errors */ - if( GDKerrbuf == 0) { - CRITICAL(M_ALL, "Could not allocate GDKerrbuf\n"); - } else { + if( GDKerrbuf == 0) + fprintf(stderr,"DFLOWworker:Could not allocate GDKerrbuf\n"); + else GDKclrerr(); - } - cntxt = ATOMIC_PTR_GET(&t->cntxt); if (cntxt) { /* wait until we are allowed to start working */ @@ -399,8 +397,8 @@ DFLOWworker(void *T) } #endif error = runMALsequence(flow->cntxt, flow->mb, fe->pc, fe->pc + 1, flow->stk, 0, 0); - DEBUG(PAR, "Executed pc=%d wrk=%d claim=" LLFMT "," LLFMT "," LLFMT " %s\n", - fe->pc, id, fe->argclaim, fe->hotclaim, fe->maxclaim, error ? error : ""); + 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 : ""); #ifdef USE_MAL_ADMISSION /* release the memory claim */ MALadmission(-fe->argclaim, -fe->hotclaim); @@ -555,7 +553,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"); - DEBUG(PAR, "Initialize dflow block\n"); + PARDEBUG fprintf(stderr, "#Initialize dflow block\n"); assign = (int *) GDKzalloc(mb->vtop * sizeof(int)); if (assign == NULL) throw(MAL, "dataflow", SQLSTATE(HY001) MAL_MALLOC_FAIL); @@ -623,7 +621,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 */ - DEBUG(PAR, "Endoflife for %s is %d -> %d\n", getVarName(mb, getArg(p, j)), n + flow->start, l); + PARDEBUG fprintf(stderr, "#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]) { @@ -665,18 +663,19 @@ DFLOWinitBlk(DataFlow flow, MalBlkPtr mb assign[getArg(p, j)] = pc; /* ensure recognition of dependency on first instruction and constant */ } GDKfree(assign); - - 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; + 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"); } } - #ifdef USE_MAL_ADMISSION memorypool = memoryclaims = 0; #endif @@ -698,10 +697,10 @@ static void showFlowEvent(DataFlow flow, int i; FlowEvent fe = flow->status; - INFO(MAL_ALL, "End of data flow '%d' done '%d'\n", pc, flow->stop - flow->start); + fprintf(stderr, "#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) { - INFO(MAL_ALL, "Missed pc %d status %d %d blocks %d\n", fe[i].state, i, fe[i].pc, fe[i].blocks); + fprintf(stderr, "#missed pc %d status %d %d blocks %d", 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); } } @@ -742,11 +741,12 @@ DFLOWscheduler(DataFlow flow, struct wor #endif q_enqueue(todo, flow->status + i); flow->status[i].state = DFLOWrunning; - DEBUG(PAR, "Enqueue pc=%d claim=" LLFMT "\n", flow->status[i].pc, flow->status[i].argclaim); + PARDEBUG fprintf(stderr, "#enqueue pc=%d claim=" LLFMT "\n", flow->status[i].pc, flow->status[i].argclaim); } MT_lock_unset(&flow->flowlock); MT_sema_up(&w->s); - DEBUG(PAR, "Run '%d' instructions in dataflow block\n", actions); + + PARDEBUG fprintf(stderr, "#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); - DEBUG(PAR, "Enqueue pc=%d claim=" LLFMT "\n", flow->status[i].pc, flow->status[i].argclaim); + PARDEBUG fprintf(stderr, "#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 ) { - DEBUG(PAR, "Errors encountered: %s\n", ret); + PARDEBUG fprintf(stderr, "#errors encountered %s ", ret); } return ret; } @@ -811,8 +811,10 @@ runMALdataflow(Client cntxt, MalBlkPtr m bit *ret; int i; - DEBUG(MAL_DATAFLOW, "Running for block: %d - %d\n", startpc, stoppc); - fprintFunction(MAL_DATAFLOW, mb, 0, LIST_MAL_ALL); +#ifdef DEBUG_FLOW + fprintf(stderr, "#runMALdataflow for block %d - %d\n", startpc, stoppc); + fprintFunction(MAL_DATAFLOW, mb, 0, LIST_ALL); +#endif /* 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,6 +23,8 @@ * 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