Changeset: 119dc0d1d0f6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=119dc0d1d0f6
Added Files:
monetdb5/modules/mal/Tests/tracer00.malC
monetdb5/modules/mal/tracer.c
monetdb5/modules/mal/tracer.h
monetdb5/modules/mal/tracer.mal
Modified Files:
monetdb5/mal/mal.c
monetdb5/mal/mal.h
monetdb5/mal/mal_atom.h
monetdb5/mal/mal_client.c
monetdb5/mal/mal_client.h
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_debugger.c
monetdb5/mal/mal_debugger.h
monetdb5/mal/mal_exception.c
monetdb5/mal/mal_exception.h
monetdb5/mal/mal_factory.c
monetdb5/mal/mal_factory.h
monetdb5/mal/mal_function.c
monetdb5/mal/mal_function.h
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_interpreter.h
monetdb5/mal/mal_listing.c
monetdb5/mal/mal_listing.h
monetdb5/mal/mal_module.c
monetdb5/mal/mal_namespace.c
monetdb5/mal/mal_parser.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_resolve.c
monetdb5/mal/mal_resolve.h
monetdb5/mal/mal_resource.c
monetdb5/mal/mal_session.c
monetdb5/modules/atoms/inet.c
monetdb5/modules/mal/Makefile.ag
monetdb5/modules/mal/groupby.c
monetdb5/modules/mal/mal_init.mal
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/mal_mapi.h
monetdb5/modules/mal/manifold.c
monetdb5/modules/mal/manifold.h
monetdb5/modules/mal/mdb.c
monetdb5/modules/mal/oltp.c
monetdb5/modules/mal/oltp.h
monetdb5/modules/mal/orderidx.c
monetdb5/modules/mal/orderidx.h
monetdb5/modules/mal/pcre.c
monetdb5/modules/mal/remote.c
monetdb5/modules/mal/remote.h
monetdb5/modules/mal/tablet.c
monetdb5/modules/mal/tablet.h
monetdb5/modules/mal/wlc.c
monetdb5/modules/mal/wlc.h
monetdb5/optimizer/opt_aliases.c
monetdb5/optimizer/opt_candidates.c
monetdb5/optimizer/opt_coercion.c
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_constants.c
monetdb5/optimizer/opt_costModel.c
monetdb5/optimizer/opt_dataflow.c
monetdb5/optimizer/opt_deadcode.c
monetdb5/optimizer/opt_emptybind.c
monetdb5/optimizer/opt_evaluate.c
monetdb5/optimizer/opt_garbageCollector.c
monetdb5/optimizer/opt_generator.c
monetdb5/optimizer/opt_inline.c
monetdb5/optimizer/opt_jit.c
monetdb5/optimizer/opt_json.c
monetdb5/optimizer/opt_macro.c
monetdb5/optimizer/opt_matpack.c
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_multiplex.c
monetdb5/optimizer/opt_oltp.c
monetdb5/optimizer/opt_pipes.c
monetdb5/optimizer/opt_postfix.c
monetdb5/optimizer/opt_profiler.c
monetdb5/optimizer/opt_projectionpath.c
monetdb5/optimizer/opt_pushselect.c
monetdb5/optimizer/opt_querylog.c
monetdb5/optimizer/opt_reduce.c
monetdb5/optimizer/opt_remap.c
monetdb5/optimizer/opt_remoteQueries.c
monetdb5/optimizer/opt_reorder.c
monetdb5/optimizer/opt_volcano.c
monetdb5/optimizer/opt_wlc.c
monetdb5/scheduler/run_memo.c
monetdb5/scheduler/run_pipeline.c
monetdb5/scheduler/run_pipeline.h
Branch: gdk_tracer
Log Message:
Added back replacements of fprintf(stderr, ...) for MAL layer
diffs (truncated from 5681 to 300 lines):
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -9,6 +9,7 @@
/* (author) M. Kersten */
#include "monetdb_config.h"
#include "mal.h"
+#include "gdk_tracer.h"
char monet_cwd[FILENAME_MAX] = { 0 };
char monet_characteristics[4096];
@@ -16,7 +17,6 @@ stream *maleventstream = 0;
/* The compile time debugging flags are turned into bit masks, akin to GDK */
lng MALdebug;
-lng OPTdebug;
#ifdef HAVE_HGE
int have_hge;
@@ -76,7 +76,7 @@ int mal_init(void){
#ifndef NDEBUG
mdbExit();
#endif
- fprintf(stderr, "%s", err);
+ ERROR(MAL_MAL, "%s\n", err);
freeException(err);
return -1;
}
@@ -106,11 +106,11 @@ void mserver_reset(void)
AUTHreset();
if (!GDKinmemory()) {
if ((err = msab_wildRetreat()) != NULL) {
- fprintf(stderr, "!%s", err);
+ ERROR(MAL_MAL, "%s\n", err);
free(err);
}
if ((err = msab_registerStop()) != NULL) {
- fprintf(stderr, "!%s", err);
+ ERROR(MAL_MAL, "%s\n", err);
free(err);
}
}
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -37,46 +37,6 @@
* for additional system variable settings.
*/
#define MAXSCRIPT 64
-
-/* The compile time debugging flags are turned into bit masks, akin to GDK */
-mal_export lng OPTdebug;
-
-#define OPTaliases (1 )
-#define OPTcandidates ((lng)1 << 1)
-#define OPTcoercion ((lng)1 << 2)
-#define OPTcommonterms ((lng)1 << 3)
-#define OPTconstants ((lng)1 << 4)
-#define OPTcostmodel ((lng)1 << 5)
-#define OPTdataflow ((lng)1 << 6)
-#define OPTdeadcode ((lng)1 << 7)
-#define OPTemptybind ((lng)1 << 8)
-#define OPTevaluate ((lng)1 << 9)
-#define OPTgarbagecollector ((lng)1 << 10)
-#define OPTgenerator ((lng)1 << 11)
-#define OPTinline ((lng)1 << 12)
-#define OPTjit ((lng)1 << 13)
-#define OPTjson ((lng)1 << 14)
-#define OPTmacros ((lng)1 << 15)
-#define OPTmatpack ((lng)1 << 15)
-#define OPTmergetable ((lng)1 << 16)
-#define OPTmitosis ((lng)1 << 17)
-#define OPTmultiplex ((lng)1 << 18)
-#define OPToltp ((lng)1 << 19)
-#define OPTpipes ((lng)1 << 20)
-#define OPTpostfix ((lng)1 << 21)
-#define OPTprelude ((lng)1 << 22)
-#define OPTprofiler ((lng)1 << 23)
-#define OPTprojectionpath ((lng)1 << 24)
-#define OPTpushselect ((lng)1 << 25)
-#define OPTquerylog ((lng)1 << 26)
-#define OPTreduce ((lng)1 << 27)
-#define OPTremap ((lng)1 << 28)
-#define OPTremotequeries ((lng)1 << 29)
-#define OPTreorder ((lng)1 << 30)
-#define OPTsupport ((lng)1 << 31)
-#define OPTvolcano ((lng)1 << 32)
-#define OPTwlc ((lng)1 << 33)
-
mal_export lng MALdebug;
/*
@@ -108,7 +68,6 @@ mal_export int have_hge;
#define GRPmodules (LOADMASK)
#define GRPalgorithms (ALGOMASK | ESTIMASK)
#define GRPperformance (DEADBEEFMASK)
-#define GRPoptimizers (OPTMASK)
#define GRPforcemito (FORCEMITOMASK | NOSYNCMASK)
mal_export MT_Lock mal_contextLock;
diff --git a/monetdb5/mal/mal_atom.h b/monetdb5/mal/mal_atom.h
--- a/monetdb5/mal/mal_atom.h
+++ b/monetdb5/mal/mal_atom.h
@@ -9,8 +9,6 @@
#ifndef _MAL_ATOM_H
#define _MAL_ATOM_H
-/* #define MAL_ATOM_DEBUG */
-
mal_export int malAtomSize(int size, const char *name);
mal_export void mal_atom_reset(void);
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
@@ -46,6 +46,7 @@
#include "mal_private.h"
#include "mal_runtime.h"
#include "mal_authorize.h"
+#include "gdk_tracer.h"
int MAL_MAXCLIENTS = 0;
ClientRec *mal_clients;
@@ -69,7 +70,7 @@ MCinit(void)
if (maxclients <= 0) {
maxclients = 64;
if (GDKsetenv("max_clients", "64") != GDK_SUCCEED) {
- fprintf(stderr, "!MCinit: GDKsetenv failed");
+ CRITICAL(MAL_CLIENT, "GDKsetenv failed\n");
return false;
}
}
@@ -77,7 +78,7 @@ MCinit(void)
MAL_MAXCLIENTS = /* client connections */ maxclients;
mal_clients = GDKzalloc(sizeof(ClientRec) * MAL_MAXCLIENTS);
if( mal_clients == NULL){
- fprintf(stderr,"!MCinit:" MAL_MALLOC_FAIL);
+ CRITICAL(MAL_CLIENT, "Initialization failed: " MAL_MALLOC_FAIL
"\n");
return false;
}
for (int i = 0; i < MAL_MAXCLIENTS; i++)
@@ -144,9 +145,7 @@ MCnewClient(void)
if (c == mal_clients + MAL_MAXCLIENTS)
return NULL;
c->idx = (int) (c - mal_clients);
-#ifdef MAL_CLIENT_DEBUG
- fprintf(stderr,"New client created %d\n", (int) (c - mal_clients));
-#endif
+ DEBUG(MAL_CLIENT, "New client created: %d\n", (int) (c - mal_clients));
return c;
}
@@ -187,9 +186,7 @@ MCresetProfiler(stream *fdout)
void
MCexitClient(Client c)
{
-#ifdef MAL_CLIENT_DEBUG
- fprintf(stderr,"# Exit client %d\n", c->idx);
-#endif
+ DEBUG(MAL_CLIENT, "Exit client: %d\n", c->idx);
finishSessionProfiler(c);
MCresetProfiler(c->fdout);
if (c->father == NULL) { /* normal client */
@@ -225,7 +222,7 @@ MCinitClientRecord(Client c, oid user, b
MT_lock_set(&mal_contextLock);
c->mode = FREECLIENT;
MT_lock_unset(&mal_contextLock);
- fprintf(stderr,"!initClientRecord:" MAL_MALLOC_FAIL);
+ CRITICAL(MAL_CLIENT, "Initialization failed: " MAL_MALLOC_FAIL
"\n");
return NULL;
}
c->yycur = 0;
@@ -262,7 +259,7 @@ MCinitClientRecord(Client c, oid user, b
c->mode = FREECLIENT;
MT_lock_unset(&mal_contextLock);
}
- fprintf(stderr, "!initClientRecord:" MAL_MALLOC_FAIL);
+ CRITICAL(MAL_CLIENT, "Initialization failed: " MAL_MALLOC_FAIL
"\n");
return NULL;
}
c->promptlength = strlen(prompt);
@@ -409,9 +406,7 @@ MCfreeClient(Client c)
return;
c->mode = FINISHCLIENT;
-#ifdef MAL_CLIENT_DEBUG
- fprintf(stderr,"# Free client %d\n", c->idx);
-#endif
+ DEBUG(MAL_CLIENT, "Free client: %d\n", c->idx);
MCexitClient(c);
/* scope list and curprg can not be removed, because the client may
@@ -526,9 +521,7 @@ MCactiveClients(void)
void
MCcloseClient(Client c)
{
-#ifdef MAL_DEBUG_CLIENT
- fprintf(stderr,"closeClient %d " OIDFMT "\n", (int) (c - mal_clients),
c->user);
-#endif
+ DEBUG(MAL_CLIENT, "Close client: %d " OIDFMT "\n", (int) (c -
mal_clients), c->user);
/* free resources of a single thread */
MCfreeClient(c);
}
@@ -578,10 +571,7 @@ MCreadClient(Client c)
{
bstream *in = c->fdin;
-#ifdef MAL_CLIENT_DEBUG
- fprintf(stderr,"# streamClient %d %d\n", c->idx,
isa_block_stream(in->s));
-#endif
-
+ DEBUG(MAL_CLIENT, "Stream client: %d %d\n", c->idx,
isa_block_stream(in->s));
while (in->pos < in->len &&
(isspace((unsigned char) (in->buf[in->pos])) ||
in->buf[in->pos] == ';' || !in->buf[in->pos]))
@@ -613,15 +603,11 @@ MCreadClient(Client c)
if (p != in->buf + in->len - 1)
in->len++;
}
-#ifdef MAL_CLIENT_DEBUG
- fprintf(stderr, "# simple stream received %d sum %zu\n",
c->idx, sum);
-#endif
+ DEBUG(MAL_CLIENT, "Received simple stream: %d - sum %zu\n",
c->idx, sum);
}
if (in->pos >= in->len) {
/* end of stream reached */
-#ifdef MAL_CLIENT_DEBUG
- fprintf(stderr,"# end of stream received %d %d\n", c->idx,
c->bak == 0);
-#endif
+ DEBUG(MAL_CLIENT, "End of received stream: %d %d\n", c->idx,
c->bak == 0);
if (c->bak) {
MCpopClientInput(c);
if (c->fdin == NULL)
@@ -630,10 +616,8 @@ MCreadClient(Client c)
}
return 0;
}
-#ifdef MAL_CLIENT_DEBUG
- fprintf(stderr,"# finished stream read %d %d\n", (int) in->pos, (int)
in->len);
- printf("#%s\n", in->buf);
-#endif
+ DEBUG(MAL_CLIENT, "Finished reading stream: %d %d\n", (int) in->pos,
(int) in->len);
+ DEBUG(MAL_CLIENT, "%s\n", in->buf);
return 1;
}
diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h
--- a/monetdb5/mal/mal_client.h
+++ b/monetdb5/mal/mal_client.h
@@ -10,7 +10,6 @@
#define _MAL_CLIENT_H_
#include "mal.h"
-/*#define MAL_CLIENT_DEBUG */
#include "mal_resolve.h"
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
@@ -30,6 +30,7 @@
#include "mal_private.h"
#include "mal_runtime.h"
#include "mal_resource.h"
+#include "gdk_tracer.h"
#define DFLOWpending 0 /* runnable */
#define DFLOWrunning 1 /* currently in progress */
@@ -335,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(MAL_DATAFLOW, "Could not allocate GDKerrbuf\n");
+ } else {
GDKclrerr();
+ }
+
cntxt = ATOMIC_PTR_GET(&t->cntxt);
if (cntxt) {
/* wait until we are allowed to start working */
@@ -395,7 +398,7 @@ DFLOWworker(void *T)
}
}
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",
+ DEBUG(PAR, "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);
@@ -547,7 +550,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));
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list