Changeset: cdc7066fbf21 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cdc7066fbf21
Modified Files:
        clients/Tests/exports.stable.out
        gdk/gdk.h
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_bbp.c
        gdk/gdk_storage.c
        gdk/gdk_system_private.h
        gdk/gdk_tracer.c
        gdk/gdk_tracer.h
        geom/lib/libgeom.c
        monetdb5/mal/mal_function.c
        monetdb5/mal/mal_function.h
        monetdb5/mal/mal_listing.c
        monetdb5/mal/mal_listing.h
        monetdb5/modules/mal/manifold.c
        monetdb5/modules/mal/tracer.c
        monetdb5/optimizer/opt_commonTerms.c
        sql/backends/monet5/sql.c
Branch: Mar2025
Log Message:

Tracer cleanup.
Use private namespace by prepending TRC_ to components and levels, but
this is all hidden inside the tracer macros.
Also fix some places where the tracer was used incorrectly.


diffs (truncated from 1164 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1311,8 +1311,7 @@ const char thetajoinRef[];
 const char thetaselectRef[];
 const char tidRef[];
 const char totalRef[];
-void traceFunction(component_t comp, MalBlkPtr mb, MalStkPtr stk, int flg);
-void traceInstruction(component_t comp, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
p, int flg);
+void traceInstruction(MalBlkPtr mb, MalStkPtr stk, InstrPtr p, int flg);
 const char transactionRef[];
 const char transaction_abortRef[];
 const char transaction_beginRef[];
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1674,12 +1674,10 @@ BATnegateprops(BAT *b)
 
 gdk_export gdk_return GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT 
*log_level);
 
-#define GDKerror(...)                                          \
-       GDKtracer_log(__FILE__, __func__, __LINE__, M_ERROR,    \
-                     GDK, NULL, __VA_ARGS__)
+#define GDKerror(...)          TRC_ERROR(GDK, __VA_ARGS__)
 #define GDKsyserr(errno, ...)                                          \
-       GDKtracer_log(__FILE__, __func__, __LINE__, M_ERROR,            \
-                     GDK, GDKstrerror(errno, (char[64]){0}, 64),       \
+       GDKtracer_log(__FILE__, __func__, __LINE__, TRC_M_ERROR,        \
+                     TRC_GDK, GDKstrerror(errno, (char[64]){0}, 64),   \
                      __VA_ARGS__)
 #define GDKsyserror(...)       GDKsyserr(errno, __VA_ARGS__)
 
@@ -1947,7 +1945,7 @@ BBPcheck(bat x)
                assert(x > 0);
 
                if (x < 0 || x >= getBBPsize() || BBP_logical(x) == NULL) {
-                       TRC_DEBUG(CHECK_, "range error %d\n", (int) x);
+                       TRC_DEBUG(CHECK, "range error %d\n", (int) x);
                } else {
                        assert(BBP_pid(x) == 0 || BBP_pid(x) == MT_getpid());
                        return x;
@@ -2379,7 +2377,7 @@ TIMEOUT_ERROR(const QryCtx *qc, const ch
 {
        const char *e = TIMEOUT_MESSAGE(qc);
        if (e) {
-               GDKtracer_log(file, func, lineno, M_ERROR, GDK, NULL,
+               GDKtracer_log(file, func, lineno, TRC_M_ERROR, TRC_GDK, NULL,
                              "%s\n", e);
        }
 }
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -2174,12 +2174,12 @@ backup_new(Heap *hp, bool lock)
                        if ((ret = MT_rename(batpath, bakpath)) < 0)
                                GDKsyserror("backup_new: rename %s to %s 
failed\n",
                                            batpath, bakpath);
-                       TRC_DEBUG(IO_, "rename(%s,%s) = %d\n", batpath, 
bakpath, ret);
+                       TRC_DEBUG(IO, "rename(%s,%s) = %d\n", batpath, bakpath, 
ret);
                } else if (batret == 0) {
                        /* there is a backup already; just remove the X.new */
                        if ((ret = MT_remove(batpath)) != 0)
                                GDKsyserror("backup_new: remove %s failed\n", 
batpath);
-                       TRC_DEBUG(IO_, "remove(%s) = %d\n", batpath, ret);
+                       TRC_DEBUG(IO, "remove(%s) = %d\n", batpath, ret);
                } else {
                        ret = 0;
                }
@@ -2806,7 +2806,7 @@ BATassertProps(BAT *b)
                        BUN mask;
 
                        if ((hs = GDKzalloc(sizeof(Hash))) == NULL) {
-                               TRC_WARNING(BAT_, "Cannot allocate hash 
table\n");
+                               TRC_WARNING(BAT, "Cannot allocate hash 
table\n");
                                goto abort_check;
                        }
                        if (snprintf(hs->heaplink.filename, 
sizeof(hs->heaplink.filename), "%s.thshprpl%x", nme, (unsigned) MT_getpid()) >= 
(int) sizeof(hs->heaplink.filename) ||
@@ -2815,7 +2815,7 @@ BATassertProps(BAT *b)
                                 * about sizes near definition of
                                 * BBPINIT */
                                GDKfree(hs);
-                               TRC_CRITICAL(BAT_, "Heap filename is too 
large\n");
+                               TRC_CRITICAL(BAT, "Heap filename is too 
large\n");
                                goto abort_check;
                        }
                        if (ATOMsize(b->ttype) == 1)
@@ -2833,7 +2833,7 @@ BATassertProps(BAT *b)
                            HASHnew(hs, b->ttype, BATcount(b),
                                    mask, BUN_NONE, false) != GDK_SUCCEED) {
                                GDKfree(hs);
-                               TRC_WARNING(BAT_, "Cannot allocate hash 
table\n");
+                               TRC_WARNING(BAT, "Cannot allocate hash 
table\n");
                                goto abort_check;
                        }
                        BATloop(b, p, q) {
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -704,7 +704,7 @@ BATappend2(BAT *b, BAT *n, BAT *s, bool 
 
        if (BATttype(b) != BATttype(n) &&
            ATOMtype(b->ttype) != ATOMtype(n->ttype)) {
-               TRC_DEBUG(CHECK_, "Interpreting %s as %s.\n",
+               TRC_DEBUG(CHECK, "Interpreting %s as %s.\n",
                          ATOMname(BATttype(n)), ATOMname(BATttype(b)));
        }
 
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -392,7 +392,7 @@ BBPgetfilename(char *s, size_t len, bat 
                s = p;
        }
        if (snprintf(s, len, "%o", i) >= (int) len)
-               TRC_CRITICAL(BAT_, "impossible error\n");
+               TRC_CRITICAL(BAT, "impossible error\n");
 }
 
 static gdk_return BBPrecover(int farmid);
@@ -1655,7 +1655,7 @@ BBPtrim(bool aggressive, bat nbat)
                }
                MT_lock_unset(&GDKswapLock(bid));
                if (swap) {
-                       TRC_DEBUG(BAT_, "unload and free bat %d\n", bid);
+                       TRC_DEBUG(BAT, "unload and free bat %d\n", bid);
                        if (BBPfree(b) != GDK_SUCCEED)
                                GDKerror("unload failed for bat %d", bid);
                        n++;
@@ -1669,7 +1669,7 @@ BBPtrim(bool aggressive, bat nbat)
                }
        }
        if (n > 0)
-               TRC_INFO(BAT_, "unloaded %d bats in "LLFMT" usec%s\n", n, 
GDKusec() - t0, aggressive ? " (also hot)" : "");
+               TRC_INFO(BAT, "unloaded %d bats in "LLFMT" usec%s\n", n, 
GDKusec() - t0, aggressive ? " (also hot)" : "");
        return changed;
 }
 
@@ -1691,7 +1691,7 @@ BBPmanager(void *dummy)
                        }
                        MT_lock_unset(&GDKswapLock(bid));
                }
-               TRC_DEBUG(BAT_, "cleared HOT bit from %d bats\n", n);
+               TRC_DEBUG(BAT, "cleared HOT bit from %d bats\n", n);
                size_t cur = GDKvm_cursize();
                MT_thread_setworking("sleeping");
                for (int i = 0, n = changed && cur > GDK_vm_maxsize / 2 ? 1 : 
cur > GDK_vm_maxsize / 4 ? 10 : 100; i < n; i++) {
@@ -1796,13 +1796,13 @@ BBPinit(bool allow_hge_upgrade, bool no_
                        if (MT_stat(backupbbpdirstr, &st) < 0) {
                                /* no BBP.bak (nor BBP.dir or BACKUP/BBP.dir):
                                 * create a new one */
-                               TRC_DEBUG(IO_, "initializing BBP.\n");
+                               TRC_DEBUG(IO, "initializing BBP.\n");
                                if (BBPdir_init() != GDK_SUCCEED) {
                                        BBPtmunlock();
                                        goto bailout;
                                }
                        } else if (GDKmove(0, BATDIR, "BBP", "bak", BATDIR, 
"BBP", "dir", true) == GDK_SUCCEED)
-                               TRC_DEBUG(IO_, "reverting to dir saved in 
BBP.bak.\n");
+                               TRC_DEBUG(IO, "reverting to dir saved in 
BBP.bak.\n");
 
                        if ((fp = GDKfilelocate(0, "BBP", "r", "dir")) == NULL) 
{
                                GDKsyserror("cannot open BBP.dir");
@@ -2199,7 +2199,7 @@ BBPdir_first(bool subcommit, lng logno, 
        if (n < (bat) ATOMIC_GET(&BBPsize))
                n = (bat) ATOMIC_GET(&BBPsize);
 
-       TRC_DEBUG(IO_, "writing BBP.dir (%d bats).\n", n);
+       TRC_DEBUG(IO, "writing BBP.dir (%d bats).\n", n);
 
        if (BBPdir_header(nbbpf, n, logno) != GDK_SUCCEED) {
                goto bailout;
@@ -2312,7 +2312,7 @@ BBPdir_last(int n, char *buf, size_t buf
                goto bailout;
        }
 
-       TRC_DEBUG(IO_, "end\n");
+       TRC_DEBUG(IO, "end\n");
 
        return GDK_SUCCEED;
 
@@ -2571,7 +2571,7 @@ BBPallocbat(int tt)
        /* Keep the physical location around forever */
        if (!GDKinmemory(0) && *BBP_physical(i) == 0) {
                BBPgetfilename(BBP_physical(i), sizeof(BBP_physical(i)), i);
-               TRC_DEBUG(BAT_, "%d = new %s(%s)\n", (int) i, BBP_logical(i), 
ATOMname(tt));
+               TRC_DEBUG(BAT, "%d = new %s(%s)\n", (int) i, BBP_logical(i), 
ATOMname(tt));
        }
 
        return i;
@@ -2617,7 +2617,7 @@ BBPuncacheit(bat i, bool unloaddesc)
                assert(unloaddesc || BBP_refs(i) == 0);
 
                if (BBP_status(i) & BBPLOADED) {
-                       TRC_DEBUG(BAT_, "uncache %d (%s)\n", (int) i, 
BBP_logical(i));
+                       TRC_DEBUG(BAT, "uncache %d (%s)\n", (int) i, 
BBP_logical(i));
 
                        /* clearing bits can be done without the lock */
                        BBP_status_off(i, BBPLOADED);
@@ -2685,9 +2685,9 @@ bbpclear(bat i, bool lock)
 {
        struct freebats *t = MT_thread_getfreebats();
 
-       TRC_DEBUG(BAT_, "clear %d (%s)\n", (int) i, BBP_logical(i));
+       TRC_DEBUG(BAT, "clear %d (%s)\n", (int) i, BBP_logical(i));
        BBPuncacheit(i, true);
-       TRC_DEBUG(BAT_, "set to unloading %d\n", i);
+       TRC_DEBUG(BAT, "set to unloading %d\n", i);
        if (lock) {
                MT_lock_set(&GDKswapLock(i));
        }
@@ -2863,7 +2863,7 @@ BBPspin(bat i, const char *s, unsigned e
                        MT_sleep_ms(KITTENNAP);
                        spin++;
                } while (BBP_status(i) & event);
-               TRC_DEBUG(BAT_, "%d,%s,%u: " LLFMT " loops\n", (int) i, s, 
event, spin);
+               TRC_DEBUG(BAT, "%d,%s,%u: " LLFMT " loops\n", (int) i, s, 
event, spin);
        }
 }
 
@@ -3041,7 +3041,7 @@ decref(bat i, bool logical, bool lock, c
                 * while locked so no other thread thinks it's
                 * available anymore */
                assert((BBP_status(i) & BBPUNLOADING) == 0);
-               TRC_DEBUG(BAT_, "%s set to unloading BAT %d (status %u, lrefs 
%d)\n", func, i, BBP_status(i), BBP_lrefs(i));
+               TRC_DEBUG(BAT, "%s set to unloading BAT %d (status %u, lrefs 
%d)\n", func, i, BBP_status(i), BBP_lrefs(i));
                BBP_status_on(i, BBPUNLOADING);
                swap = true;
        } /* else: bat cannot be swapped out */
@@ -3061,7 +3061,7 @@ decref(bat i, bool logical, bool lock, c
                                 * disk (if transient but saved) */
                                BBPdestroy(b);
                        } else {
-                               TRC_DEBUG(BAT_, "%s unload and free bat %d\n", 
func, i);
+                               TRC_DEBUG(BAT, "%s unload and free bat %d\n", 
func, i);
                                /* free memory of transient */
                                if (BBPfree(b) != GDK_SUCCEED)
                                        return -1;      /* indicate failure */
@@ -3173,13 +3173,13 @@ getBBPdescriptor(bat i)
                if (BBPvalid(i)) {
                        if ((BBP_status(i) & BBPLOADED) == 0) {
                                load = true;
-                               TRC_DEBUG(BAT_, "set to loading BAT %d\n", i);
+                               TRC_DEBUG(BAT, "set to loading BAT %d\n", i);
                                BBP_status_on(i, BBPLOADING);
                        }
                }
        }
        if (load) {
-               TRC_DEBUG(IO_, "load %s\n", BBP_logical(i));
+               TRC_DEBUG(IO, "load %s\n", BBP_logical(i));
 
                b = BATload_intern(i, false);
 
@@ -3238,7 +3238,7 @@ BBPsave(BAT *b)
                if (lock)
                        MT_lock_unset(&GDKswapLock(bid));
 
-               TRC_DEBUG(IO_, "save " ALGOBATFMT "\n", ALGOBATPAR(b));
+               TRC_DEBUG(IO, "save " ALGOBATFMT "\n", ALGOBATPAR(b));
 
                /* do the time-consuming work unlocked */
                if (BBP_status(bid) & BBPEXISTING && b->batInserted > 0)
@@ -3303,7 +3303,7 @@ BBPfree(BAT *b)
                        BATfree(b);     /* free memory */
                BBPuncacheit(bid, false);
        }
-       TRC_DEBUG(BAT_, "turn off unloading %d\n", bid);
+       TRC_DEBUG(BAT, "turn off unloading %d\n", bid);
        BBP_status_off(bid, BBPUNLOADING);
        BBP_unload_dec();
        return ret;
@@ -3413,7 +3413,7 @@ file_exists(int farmid, const char *dir,
 
        if (GDKfilepath(path, sizeof(path), farmid, dir, name, ext) == 
GDK_SUCCEED) {
                ret = MT_stat(path, &st);
-               TRC_DEBUG(IO_, "stat(%s) = %d\n", path, ret);
+               TRC_DEBUG(IO, "stat(%s) = %d\n", path, ret);
        }
        return (ret == 0);
 }
@@ -3448,7 +3448,7 @@ heap_move(Heap *hp, const char *srcdir, 
                fp = MT_fopen(path, "w");
                if (fp == NULL)
                        GDKsyserror("heap_move: cannot open file %s\n", path);
-               TRC_DEBUG(IO_, "open %s = %d\n", path, fp ? 0 : -1);
+               TRC_DEBUG(IO, "open %s = %d\n", path, fp ? 0 : -1);
 
                if (fp != NULL) {
                        fclose(fp);
@@ -3505,7 +3505,7 @@ BBPprepare(bool subcommit)
                        return GDK_FAIL;
                }
                /* if BAKDIR already exists, don't signal error */
-               TRC_DEBUG(IO_, "mkdir %s = %d\n", bakdirpath, (int) ret);
+               TRC_DEBUG(IO, "mkdir %s = %d\n", bakdirpath, (int) ret);
        }
        if (start_subcommit) {
                /* make a new SUBDIR (subdir of BAKDIR) */
@@ -3519,7 +3519,7 @@ BBPprepare(bool subcommit)
                        GDKsyserror("cannot create directory %s\n", subdirpath);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to