Changeset: b3447646acf3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b3447646acf3
Modified Files:
        gdk/gdk_batop.c
        gdk/gdk_bbp.c
        gdk/gdk_system.c
        monetdb5/mal/mal_instruction.c
Branch: Aug2018
Log Message:

Fixes/improvements to debug code and to comments.


diffs (93 lines):

diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1015,8 +1015,10 @@ BATslice(BAT *b, BUN l, BUN h)
                bn->trevsorted = b->trevsorted;
                BATkey(bn, BATtkey(b));
        }
-       ALGODEBUG fprintf(stderr, "#BATslice()=" ALGOBATFMT "\n",
-                         ALGOBATPAR(bn));
+       ALGODEBUG fprintf(stderr,
+                         "#BATslice(" ALGOBATFMT "," BUNFMT "," BUNFMT ")"
+                         "=" ALGOBATFMT "\n",
+                         ALGOBATPAR(b), l, h, ALGOBATPAR(bn));
        return bn;
       bunins_failed:
        BBPreclaim(bn);
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2653,7 +2653,7 @@ getBBPdescriptor(bat i, bool lock)
                        if (b == NULL) {
                                load = true;
                                BATDEBUG {
-                                       fprintf(stderr, "#BBPdescriptor set to 
unloading BAT %d\n", i);
+                                       fprintf(stderr, "#BBPdescriptor set to 
loading BAT %d\n", i);
                                }
                                BBP_status_on(i, BBPLOADING, "BBPdescriptor");
                        }
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -82,10 +82,9 @@ sortlocklist(MT_Lock *l)
        while (l && r) {
                if (l->sleep < r->sleep ||
                    (l->sleep == r->sleep &&
-                    l->contention < r->contention) ||
-                   (l->sleep == r->sleep &&
-                    l->contention == r->contention &&
-                    l->count <= r->count)) {
+                    (l->contention < r->contention ||
+                     (l->contention == r->contention &&
+                      l->count <= r->count)))) {
                        /* l is smaller */
                        if (ll == NULL) {
                                assert(t == NULL);
@@ -116,14 +115,25 @@ void
 GDKlockstatistics(int what)
 {
        MT_Lock *l;
+       int n = 0;
 
        if (ATOMIC_TAS(GDKlocklistlock, dummy) != 0) {
                fprintf(stderr, "#WARNING: GDKlocklistlock is set, so cannot 
access lock list\n");
                return;
        }
+       if (what == -1) {
+               for (l = GDKlocklist; l; l = l->next) {
+                       l->count = 0;
+                       l->contention = 0;
+                       l->sleep = 0;
+               }
+               ATOMIC_CLEAR(GDKlocklistlock, dummy);
+               return;
+       }
        GDKlocklist = sortlocklist(GDKlocklist);
        fprintf(stderr, "# lock 
name\tcount\tcontention\tsleep\tlocked\t(un)locker\n");
-       for (l = GDKlocklist; l; l = l->next)
+       for (l = GDKlocklist; l; l = l->next) {
+               n++;
                if (what == 0 ||
                    (what == 1 && l->count) ||
                    (what == 2 && l->contention) ||
@@ -133,6 +143,8 @@ GDKlockstatistics(int what)
                                l->count, l->contention, l->sleep,
                                l->lock ? "locked" : "",
                                l->locker ? l->locker : "");
+       }
+       fprintf(stderr, "#number of locks  %d\n", n);
        fprintf(stderr, "#total lock count %zu\n", (size_t) GDKlockcnt);
        fprintf(stderr, "#lock contention  %zu\n", (size_t) 
GDKlockcontentioncnt);
        fprintf(stderr, "#lock sleep count %zu\n", (size_t) GDKlocksleepcnt);
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -111,7 +111,7 @@ newMalBlk(int elements)
        if (mb == NULL)
                return NULL;
 
-       /* each MAL instruction implies at least on variable 
+       /* each MAL instruction implies at least one variable 
         * we reserve some extra for constants */
        v = (VarRecord *) GDKzalloc(sizeof(VarRecord) * (elements + 8) );
        if (v == NULL) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to