Changeset: ae88609b20cf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ae88609b20cf
Modified Files:
        gdk/gdk.h
        gdk/gdk_bbp.c
        gdk/gdk_hash.c
        gdk/gdk_imprints.c
        gdk/gdk_posix.c
        gdk/gdk_system.c
        gdk/gdk_system.h
        gdk/gdk_tm.c
        gdk/gdk_tracer.h
        gdk/gdk_utils.c
Branch: default
Log Message:

Converted all remaining XXXDEBUG prints to TRC_DEBUG; single component for GDK.
Removed all XXXDEBUG macros for debug messages (i.e. not CHECKDEBUG
and PROPDEBUG) to force conversion to TRC_DEBUG when merging.


diffs (truncated from 1015 to 300 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -361,41 +361,31 @@
 */
 
 #define THRDMASK       (1)
-#define THRDDEBUG      if (GDKdebug & THRDMASK)
 #define CHECKMASK      (1<<1)
 #define CHECKDEBUG     if (GDKdebug & CHECKMASK)
 #define MEMMASK                (1<<2)
-#define MEMDEBUG       if (GDKdebug & MEMMASK)
 #define PROPMASK       (1<<3)
 #define PROPDEBUG      if (GDKdebug & PROPMASK)
 #define IOMASK         (1<<4)
-#define IODEBUG                if (GDKdebug & IOMASK)
 #define BATMASK                (1<<5)
-#define BATDEBUG       if (GDKdebug & BATMASK)
 /* PARSEMASK not used anymore
 #define PARSEMASK      (1<<6)
 #define PARSEDEBUG     if (GDKdebug & PARSEMASK)
 */
 #define PARMASK                (1<<7)
-#define PARDEBUG       if (GDKdebug & PARMASK)
 /* HEADLESSMASK not used anymore
 #define HEADLESSMASK   (1<<8)
 #define HEADLESSDEBUG  if (GDKdebug & HEADLESSMASK)
 */
 #define TMMASK         (1<<9)
-#define TMDEBUG                if (GDKdebug & TMMASK)
 #define TEMMASK                (1<<10)
-#define TEMDEBUG       if (GDKdebug & TEMMASK)
 /* DLMASK not used anymore
 #define DLMASK         (1<<11)
 #define DLDEBUG                if (GDKdebug & DLMASK)
 */
 #define PERFMASK       (1<<12)
-#define PERFDEBUG      if (GDKdebug & PERFMASK)
 #define DELTAMASK      (1<<13)
-#define DELTADEBUG     if (GDKdebug & DELTAMASK)
 #define LOADMASK       (1<<14)
-#define LOADDEBUG      if (GDKdebug & LOADMASK)
 /* YACCMASK not used anymore
 #define YACCMASK       (1<<15)
 #define YACCDEBUG      if (GDKdebug & YACCMASK)
@@ -408,11 +398,8 @@
 #define ?ddbench?      if (GDKdebug&(1<<20))
 */
 #define ACCELMASK      (1<<20)
-#define ACCELDEBUG     if (GDKdebug & (ACCELMASK|ALGOMASK))
 #define ALGOMASK       (1<<21)
-#define ALGODEBUG      if (GDKdebug & ALGOMASK)
 #define ESTIMASK       (1<<22)
-#define ESTIDEBUG      if (GDKdebug & ESTIMASK)
 /* XPROPMASK not used anymore
 #define XPROPMASK      (1<<23)
 #define XPROPDEBUG     if (GDKdebug & XPROPMASK)
@@ -424,16 +411,13 @@
 #define DEADBEEFCHK    if (!(GDKdebug & DEADBEEFMASK))
 
 #define ALLOCMASK      (1<<26)
-#define ALLOCDEBUG     if (GDKdebug & ALLOCMASK)
 
 /* M5, only; cf.,
  * monetdb5/mal/mal.h
  */
 #define OPTMASK                (1<<27)
-#define OPTDEBUG       if (GDKdebug & OPTMASK)
 
 #define HEAPMASK       (1<<28)
-#define HEAPDEBUG      if (GDKdebug & HEAPMASK)
 
 #define FORCEMITOMASK  (1<<29)
 #define FORCEMITODEBUG if (GDKdebug & FORCEMITOMASK)
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -375,9 +375,9 @@ recover_dir(int farmid, bool direxists)
        if (direxists) {
                /* just try; don't care about these non-vital files */
                if (GDKunlink(farmid, BATDIR, "BBP", "bak") != GDK_SUCCEED)
-                       fprintf(stderr, "#recover_dir: unlink of BBP.bak 
failed\n");
+                       TRC_WARNING(GDK, "unlink of BBP.bak failed");
                if (GDKmove(farmid, BATDIR, "BBP", "dir", BATDIR, "BBP", "bak") 
!= GDK_SUCCEED)
-                       fprintf(stderr, "#recover_dir: rename of BBP.dir to 
BBP.bak failed\n");
+                       TRC_WARNING(GDK, "rename of BBP.dir to BBP.bak failed");
        }
        return GDKmove(farmid, BAKDIR, "BBP", "dir", BATDIR, "BBP", "dir");
 }
@@ -1480,14 +1480,14 @@ BBPinit(void)
                        if (stat(backupbbpdirstr, &st) < 0) {
                                /* no BBP.bak (nor BBP.dir or BACKUP/BBP.dir):
                                 * create a new one */
-                               IODEBUG fprintf(stderr, "#BBPdir: initializing 
BBP.\n");        /* BBPdir instead of BBPinit for backward compatibility of 
error messages */
+                               TRC_DEBUG(IO_, "initializing BBP.\n");  /* 
BBPdir instead of BBPinit for backward compatibility of error messages */
                                if (BBPdir(0, NULL) != GDK_SUCCEED) {
                                        GDKfree(bbpdirstr);
                                        GDKfree(backupbbpdirstr);
                                        goto bailout;
                                }
                        } else if (GDKmove(0, BATDIR, "BBP", "bak", BATDIR, 
"BBP", "dir") == GDK_SUCCEED)
-                               IODEBUG fprintf(stderr, "#BBPinit: 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) 
{
                                GDKfree(bbpdirstr);
@@ -1722,6 +1722,18 @@ new_bbpentry(FILE *fp, bat i, const char
                GDKsyserror("new_bbpentry: Writing BBP.dir entry failed\n");
                return GDK_FAIL;
        }
+       TRC_DEBUG(IO_, "%s%zd %u %s %s %d " BUNFMT " "
+                 BUNFMT " " OIDFMT " %s", prefix,
+                 /* BAT info */
+                 (ssize_t) i,
+                 BBP_status(i) & BBPPERSISTENT,
+                 BBP_logical(i),
+                 BBP_physical(i),
+                 BBP_desc(i)->batRestricted << 1,
+                 BBP_desc(i)->batCount,
+                 BBP_desc(i)->batCapacity,
+                 BBP_desc(i)->hseqbase,
+                 BBP_options(i) ? BBP_options(i) : "");
 
        return GDK_SUCCEED;
 }
@@ -1780,7 +1792,7 @@ BBPdir_subcommit(int cnt, bat *subcommit
        if (n < (bat) ATOMIC_GET(&BBPsize))
                n = (bat) ATOMIC_GET(&BBPsize);
 
-       IODEBUG fprintf(stderr, "#BBPdir: writing BBP.dir (%d bats).\n", n);
+       TRC_DEBUG(IO_, "writing BBP.dir (%d bats).\n", n);
 
        if (BBPdir_header(nbbpf, n) != GDK_SUCCEED) {
                goto bailout;
@@ -1810,7 +1822,6 @@ BBPdir_subcommit(int cnt, bat *subcommit
                                if (new_bbpentry(nbbpf, i, "") != GDK_SUCCEED) {
                                        goto bailout;
                                }
-                               IODEBUG new_bbpentry(stderr, i, "#");
                        }
                        if (i == n)
                                n = 0;  /* read new entry (i.e. skip this one 
from old BBP.dir */
@@ -1823,7 +1834,7 @@ BBPdir_subcommit(int cnt, bat *subcommit
                                GDKsyserror("BBPdir_subcommit: Copying BBP.dir 
entry failed\n");
                                goto bailout;
                        }
-                       IODEBUG fprintf(stderr, "#%s", buf);
+                       TRC_DEBUG(IO_, "%s", buf);
                        n = 0;
                }
        }
@@ -1846,7 +1857,7 @@ BBPdir_subcommit(int cnt, bat *subcommit
                goto bailout;
        }
 
-       IODEBUG fprintf(stderr, "#BBPdir end\n");
+       TRC_DEBUG(IO_, "end\n");
 
        return GDK_SUCCEED;
 
@@ -1867,7 +1878,7 @@ BBPdir(int cnt, bat *subcommit)
        if (subcommit)
                return BBPdir_subcommit(cnt, subcommit);
 
-       IODEBUG fprintf(stderr, "#BBPdir: writing BBP.dir (%d bats).\n", (int) 
(bat) ATOMIC_GET(&BBPsize));
+       TRC_DEBUG(IO_, "writing BBP.dir (%d bats).\n", (int) (bat) 
ATOMIC_GET(&BBPsize));
        if ((fp = GDKfilelocate(0, "BBP", "w", "dir")) == NULL) {
                goto bailout;
        }
@@ -1883,7 +1894,6 @@ BBPdir(int cnt, bat *subcommit)
                        if (new_bbpentry(fp, i, "") != GDK_SUCCEED) {
                                goto bailout;
                        }
-                       IODEBUG new_bbpentry(stderr, i, "#");
                }
        }
 
@@ -1905,7 +1915,7 @@ BBPdir(int cnt, bat *subcommit)
                return GDK_FAIL;
        }
 
-       IODEBUG fprintf(stderr, "#BBPdir end\n");
+       TRC_DEBUG(IO_, "end\n");
 
        if (i < (bat) ATOMIC_GET(&BBPsize))
                return GDK_FAIL;
@@ -2247,7 +2257,7 @@ BBPinsert(BAT *bn)
                if (len == -1 || len >= FILENAME_MAX)
                        return 0;
 
-               BATDEBUG fprintf(stderr, "#%d = new %s(%s)\n", (int) i, 
BBPname(i), ATOMname(bn->ttype));
+               TRC_DEBUG(BAT_, "%d = new %s(%s)\n", (int) i, BBPname(i), 
ATOMname(bn->ttype));
        }
 
        return i;
@@ -2303,7 +2313,7 @@ BBPuncacheit(bat i, bool unloaddesc)
 
                if (b) {
                        if (BBP_cache(i)) {
-                               BATDEBUG fprintf(stderr, "#uncache %d (%s)\n", 
(int) i, BBPname(i));
+                               TRC_DEBUG(BAT_, "uncache %d (%s)\n", (int) i, 
BBPname(i));
 
                                BBP_cache(i) = NULL;
 
@@ -2325,13 +2335,9 @@ BBPuncacheit(bat i, bool unloaddesc)
 static inline void
 bbpclear(bat i, int idx, bool lock)
 {
-       BATDEBUG {
-               fprintf(stderr, "#clear %d (%s)\n", (int) i, BBPname(i));
-       }
+       TRC_DEBUG(BAT_, "clear %d (%s)\n", (int) i, BBPname(i));
        BBPuncacheit(i, true);
-       BATDEBUG {
-               fprintf(stderr, "#BBPclear set to unloading %d\n", i);
-       }
+       TRC_DEBUG(BAT_, "set to unloading %d\n", i);
        BBP_status_set(i, BBPUNLOADING, "BBPclear");
        BBP_refs(i) = 0;
        BBP_lrefs(i) = 0;
@@ -2468,7 +2474,7 @@ BBPspin(bat i, const char *s, unsigned e
                        MT_sleep_ms(KITTENNAP);
                        spin++;
                } while (BBP_status(i) & event);
-               BATDEBUG fprintf(stderr, "#BBPspin(%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);
        }
 }
 
@@ -2673,9 +2679,7 @@ decref(bat i, bool logical, bool release
                 * while locked so no other thread thinks it's
                 * available anymore */
                assert((BBP_status(i) & BBPUNLOADING) == 0);
-               BATDEBUG {
-                       fprintf(stderr, "#%s set to unloading BAT %d\n", func, 
i);
-               }
+               TRC_DEBUG(BAT_, "%s set to unloading BAT %d\n", func, i);
                BBP_status_on(i, BBPUNLOADING, func);
                swap = true;
        }
@@ -2691,9 +2695,7 @@ decref(bat i, bool logical, bool release
                         * disk (if transient but saved) */
                        BBPdestroy(b);
                } else {
-                       BATDEBUG {
-                               fprintf(stderr, "#%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, func) != GDK_SUCCEED)
                                return -1;      /* indicate failure */
@@ -2820,9 +2822,7 @@ getBBPdescriptor(bat i, bool lock)
                        b = BBP_cache(i);
                        if (b == NULL) {
                                load = true;
-                               BATDEBUG {
-                                       fprintf(stderr, "#BBPdescriptor set to 
loading BAT %d\n", i);
-                               }
+                               TRC_DEBUG(BAT_, "set to loading BAT %d\n", i);
                                BBP_status_on(i, BBPLOADING, "BBPdescriptor");
                        }
                }
@@ -2830,7 +2830,7 @@ getBBPdescriptor(bat i, bool lock)
                        MT_lock_unset(&GDKswapLock(i));
        }
        if (load) {
-               IODEBUG fprintf(stderr, "#load %s\n", BBPname(i));
+               TRC_DEBUG(IO_, "load %s\n", BBPname(i));
 
                b = BATload_intern(i, lock);
 
@@ -2891,7 +2891,7 @@ BBPsave(BAT *b)
                if (lock)
                        MT_lock_unset(&GDKswapLock(bid));
 
-               IODEBUG fprintf(stderr, "#save %s\n", BATgetId(b));
+               TRC_DEBUG(IO_, "save %s\n", BATgetId(b));
 
                /* do the time-consuming work unlocked */
                if (BBP_status(bid) & BBPEXISTING)
@@ -2964,9 +2964,7 @@ BBPfree(BAT *b, const char *calledFrom)
                BBPuncacheit(bid, false);
        }
        /* clearing bits can be done without the lock */
-       BATDEBUG {
-               fprintf(stderr, "#BBPfree turn off unloading %d\n", bid);
-       }
+       TRC_DEBUG(BAT_, "turn off unloading %d\n", bid);
        BBP_status_off(bid, BBPUNLOADING, calledFrom);
        BBP_unload_dec();
 
@@ -3094,7 +3092,7 @@ file_exists(int farmid, const char *dir,
        path = GDKfilepath(farmid, dir, name, ext);
        if (path) {
                ret = stat(path, &st);
-               IODEBUG fprintf(stderr, "#stat(%s) = %d\n", path, ret);
+               TRC_DEBUG(IO_, "stat(%s) = %d\n", path, ret);
                GDKfree(path);
        }
        return (ret == 0);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to