Changeset: 8f12d0d34544 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8f12d0d34544
Modified Files:
monetdb5/mal/mal.c
monetdb5/mal/mal_client.c
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_profiler.c
Branch: gdk_tracer
Log Message:
Couple of files patched for the tracer
diffs (173 lines):
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -66,9 +66,7 @@ int mal_init(void){
#endif
initNamespace();
initParser();
-#ifndef HAVE_EMBEDDED
initHeartbeat();
-#endif
str err = malBootstrap();
if (err != MAL_SUCCEED) {
mal_client_reset();
diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -69,8 +69,7 @@ MCinit(void)
if (maxclients <= 0) {
maxclients = 64;
if (GDKsetenv("max_clients", "64") != GDK_SUCCEED) {
- TRC_CRITICAL(MAL_CLIENT, "GDKsetenv failed\n");
- return false;
+ TRC_ERROR(MAL_CLIENT, "GDKsetenv failed\n");
}
}
@@ -221,7 +220,7 @@ MCinitClientRecord(Client c, oid user, b
MT_lock_set(&mal_contextLock);
c->mode = FREECLIENT;
MT_lock_unset(&mal_contextLock);
- TRC_CRITICAL(MAL_CLIENT, "Initialization failed: "
MAL_MALLOC_FAIL "\n");
+ TRC_ERROR(MAL_CLIENT, "No stdin channel available\n");
return NULL;
}
c->yycur = 0;
@@ -258,7 +257,7 @@ MCinitClientRecord(Client c, oid user, b
c->mode = FREECLIENT;
MT_lock_unset(&mal_contextLock);
}
- TRC_CRITICAL(MAL_CLIENT, "Initialization failed: "
MAL_MALLOC_FAIL "\n");
+ TRC_ERROR(MAL_CLIENT, "Client prompt undefined\n");
return NULL;
}
c->promptlength = strlen(prompt);
@@ -405,7 +404,6 @@ MCfreeClient(Client c)
return;
c->mode = FINISHCLIENT;
- TRC_DEBUG(MAL_CLIENT, "Free client: %d\n", c->idx);
MCexitClient(c);
/* scope list and curprg can not be removed, because the client may
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
@@ -335,9 +335,7 @@ DFLOWworker(void *T)
srand((unsigned int) GDKusec());
#endif
GDKsetbuf(GDKmalloc(GDKMAXERRLEN)); /* where to leave errors */
- if( GDKerrbuf == 0) {
- TRC_CRITICAL(MAL_DATAFLOW, "Could not allocate GDKerrbuf\n");
- } else {
+ if( GDKerrbuf ) {
GDKclrerr();
}
@@ -397,7 +395,7 @@ DFLOWworker(void *T)
}
}
error = runMALsequence(flow->cntxt, flow->mb, fe->pc, fe->pc +
1, flow->stk, 0, 0);
- TRC_DEBUG(PAR, "Executed pc=%d wrk=%d claim=" LLFMT "," LLFMT
"," LLFMT " %s\n",
+ TRC_DEBUG(MAL_DATAFLOW, "Executed pc=%d wrk=%d claim=" LLFMT
"," LLFMT "," LLFMT " %s\n",
fe->pc, id, claim,
fe->hotclaim, fe->maxclaim, error ? error : "");
/* release the memory claim */
MALadmission_release(flow->cntxt, flow->mb, flow->stk, p,
claim);
@@ -549,7 +547,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");
- TRC_DEBUG(PAR, "Initialize dflow block\n");
+ TRC_DEBUG(MAL_DATAFLOW, "Initialize dflow block\n");
assign = (int *) GDKzalloc(mb->vtop * sizeof(int));
if (assign == NULL)
throw(MAL, "dataflow", SQLSTATE(HY001) MAL_MALLOC_FAIL);
@@ -617,7 +615,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 */
- TRC_DEBUG(PAR, "Endoflife for %s is %d
-> %d\n", getVarName(mb, getArg(p, j)), n + flow->start, l);
+ TRC_DEBUG(MAL_DATAFLOW, "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]) {
@@ -661,17 +659,20 @@ DFLOWinitBlk(DataFlow flow, MalBlkPtr mb
GDKfree(assign);
/* CHECK */
- // The whole for-loop is in PARDEBUG
- for (n = 0; n < flow->stop - flow->start; n++) {
- TRC_DEBUG(PAR, "[%d] %d\n", flow->start + n, n);
- debugInstruction(PAR, mb, 0, getInstrPtr(mb, n + flow->start),
LIST_MAL_ALL);
- TRC_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]) {
- TRC_DEBUG(PAR, "%d\n", flow->start + flow->nodes[j]);
- if (flow->edges[j] == -1)
- break;
+ { char buf[8192];
+ int len = 8192;
+
+ /* only use in debugging mode compilations */
+ for (n = 0; n < flow->stop - flow->start; n++) {
+ for (j = n; flow->edges[j]; j = flow->edges[j]) {
+ len -= snprintf(buf + strlen(buf), len, "%d\n",
flow->start + flow->nodes[j]);
+ if (flow->edges[j] == -1)
+ break;
+ }
+ TRC_INFO(MAL_DATAFLOW, "[%d] %d dependents block count
%d wakeup, %s\n", flow->start + n, n, flow->status[n].blocks, buf);
}
}
+
return MAL_SUCCEED;
}
@@ -730,11 +731,10 @@ DFLOWscheduler(DataFlow flow, struct wor
fe[i].argclaim = getMemoryClaim(fe[0].flow->mb,
fe[0].flow->stk, p, j, FALSE);
q_enqueue(todo, flow->status + i);
flow->status[i].state = DFLOWrunning;
- TRC_DEBUG(PAR, "Enqueue pc=%d claim=" LLFMT "\n",
flow->status[i].pc, flow->status[i].argclaim);
+ TRC_DEBUG(MAL_DATAFLOW, "Enqueue pc=%d\n",
flow->status[i].pc);
}
MT_lock_unset(&flow->flowlock);
MT_sema_up(&w->s);
- TRC_DEBUG(PAR, "Run '%d' instructions in dataflow block\n", actions);
while (actions != tasks ) {
f = q_dequeue(flow->done, NULL);
@@ -758,7 +758,7 @@ DFLOWscheduler(DataFlow flow, struct wor
flow->status[i].state = DFLOWrunning;
flow->status[i].blocks--;
q_enqueue(todo, flow->status + i);
- TRC_DEBUG(PAR, "Enqueue pc=%d claim="
LLFMT "\n", flow->status[i].pc, flow->status[i].argclaim);
+ TRC_DEBUG(MAL_DATAFLOW, "Enqueue
pc=%d\n", flow->status[i].pc);
} else {
flow->status[i].blocks--;
}
@@ -771,7 +771,7 @@ DFLOWscheduler(DataFlow flow, struct wor
/* wrap up errors */
assert(flow->done->last == 0);
if ((ret = ATOMIC_PTR_XCG(&flow->error, NULL)) != NULL ) {
- TRC_DEBUG(PAR, "Errors encountered: %s\n", ret);
+ TRC_DEBUG(MAL_DATAFLOW, "Errors encountered: %s\n", ret);
}
return ret;
}
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -940,6 +940,9 @@ void initProfiler(void)
void initHeartbeat(void)
{
+#ifdef HAVE_EMBEDDED
+ return;
+#endif
ATOMIC_SET(&hbrunning, 1);
if (MT_create_thread(&hbthread, profilerHeartbeat, NULL,
MT_THR_JOINABLE,
"heartbeat") < 0) {
@@ -948,3 +951,5 @@ void initHeartbeat(void)
ATOMIC_SET(&hbrunning, 0);
}
}
+
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list