Changeset: d08956e6acc6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d08956e6acc6
Modified Files:
        gdk/gdk_heap.c
        gdk/gdk_utils.c
        monetdb5/mal/mal_listing.c
        sql/backends/monet5/vaults/bam/bam_wrapper.c
        sql/backends/monet5/vaults/lidar/lidar.c
        sql/backends/monet5/wlr.c
        sql/server/rel_optimizer.c
        sql/storage/store.c
Branch: gdk_tracer
Log Message:

Added #ifdef #endif (GDKtracer calls) in SQL and GDK layers


diffs (232 lines):

diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -857,7 +857,7 @@ HEAP_printstatus(Heap *heap)
        size_t block, cur_free = hheader->head;
        CHUNK *blockp;
 
-       TRC_DEBUG(TRACE, "HEAP has head %zu and alignment %d and size %zu\n",
+       TRC_DEBUG_ENDIF(TRACE, "HEAP has head %zu and alignment %d and size 
%zu\n",
                                hheader->head, hheader->alignment, heap->free);
 
        /* Walk the blocklist */
@@ -867,7 +867,7 @@ HEAP_printstatus(Heap *heap)
                blockp = HEAP_index(heap, block, CHUNK);
 
                if (block == cur_free) {
-                       TRC_DEBUG(TRACE, "Free block at %p has size %zu and 
next %zu\n",
+                       TRC_DEBUG_ENDIF(TRACE, "Free block at %p has size %zu 
and next %zu\n",
                                                (void *)block,
                                                blockp->size, blockp->next);
 
@@ -876,7 +876,7 @@ HEAP_printstatus(Heap *heap)
                } else {
                        size_t size = blocksize(hheader, blockp);
 
-                       TRC_DEBUG(TRACE, "Block at %zu with size %zu\n",
+                       TRC_DEBUG_ENDIF(TRACE, "Block at %zu with size %zu\n",
                                                block, size);
                        block += size;
                }
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -931,7 +931,7 @@ GDKreset(int status)
                }
 
 #ifdef LOCK_STATS
-               GDKlockstatistics(1);
+               TRC_DEBUG_IF(TEM) GDKlockstatistics(1);
 #endif
                GDKdebug = 0;
                GDK_mmap_minsize_persistent = MMAP_MINSIZE_PERSISTENT;
diff --git a/monetdb5/mal/mal_listing.c b/monetdb5/mal/mal_listing.c
--- a/monetdb5/mal/mal_listing.c
+++ b/monetdb5/mal/mal_listing.c
@@ -701,10 +701,10 @@ debugInstruction(COMPONENT comp, MalBlkP
        ps = instruction2str(mb, stk, p, idx, flg);
        /* ps[strlen(ps)-1] = 0; remove '\n' */
        if ( ps ){
-               TRC_DEBUG(comp, "%s%s\n", (flg & LIST_MAL_MAPI ? "=" : ""), ps);
+               TRC_DEBUG_ENDIF(comp, "%s%s\n", (flg & LIST_MAL_MAPI ? "=" : 
""), ps);
                GDKfree(ps);
        } else {
-               TRC_DEBUG(comp, "Failed instruction2str()\n");
+               TRC_DEBUG_ENDIF(comp, "Failed instruction2str()\n");
        }
 
        /* compiler complains about unused parameter */
diff --git a/sql/backends/monet5/vaults/bam/bam_wrapper.c 
b/sql/backends/monet5/vaults/bam/bam_wrapper.c
--- a/sql/backends/monet5/vaults/bam/bam_wrapper.c
+++ b/sql/backends/monet5/vaults/bam/bam_wrapper.c
@@ -1325,12 +1325,15 @@ check_alignment_buffers(bam_wrapper *bw,
                alig->qual = tmp;
        }
 
-       if (resized[0])
-               TRC_DEBUG(BAM_, "Increased size of qname buffer to: %d 
characters\n", alig->qname_size);
-       if (resized[1])
-               TRC_DEBUG(BAM_, "Increased size of cigar buffer to: %d 
characters\n", alig->cigar_size);
-       if (resized[2])
-               TRC_DEBUG(BAM_, "Increased size of seq and qual buffers to: %d 
characters\n", alig->seq_size);
+       TRC_DEBUG_IF(BAM_)
+       {
+               if (resized[0])
+                       TRC_DEBUG_ENDIF(BAM_, "Increased size of qname buffer 
to: %d characters\n", alig->qname_size);
+               if (resized[1])
+                       TRC_DEBUG_ENDIF(BAM_, "Increased size of cigar buffer 
to: %d characters\n", alig->cigar_size);
+               if (resized[2])
+                       TRC_DEBUG_ENDIF(BAM_, "Increased size of seq and qual 
buffers to: %d characters\n", alig->seq_size);
+       }
 
        return (alig->cigar != NULL && alig->seq != NULL
                && alig->qual != NULL);
diff --git a/sql/backends/monet5/vaults/lidar/lidar.c 
b/sql/backends/monet5/vaults/lidar/lidar.c
--- a/sql/backends/monet5/vaults/lidar/lidar.c
+++ b/sql/backends/monet5/vaults/lidar/lidar.c
@@ -951,8 +951,11 @@ str LIDARloadTable(Client cntxt, MalBlkP
        col = mvc_bind_column(m, lidar_tbl, "PointRecordsCount");
        rows = *(int*)table_funcs.column_find_value(m->session->tr, col, rid);
 
-       TRC_DEBUG(LIDAR, "Loading '%ld' rows in table '%s'\n", rows, tname);
-       time0 = GDKms();
+       TRC_DEBUG_IF(LIDAR)
+       {
+               TRC_DEBUG_ENDIF(LIDAR, "Loading '%ld' rows in table '%s'\n", 
rows, tname);
+               time0 = GDKms();
+       }
 
        colx = mvc_bind_column(m, tbl, "x");
        coly = mvc_bind_column(m, tbl, "y");
diff --git a/sql/backends/monet5/wlr.c b/sql/backends/monet5/wlr.c
--- a/sql/backends/monet5/wlr.c
+++ b/sql/backends/monet5/wlr.c
@@ -307,15 +307,19 @@ WLRprocessBatch(void *arg)
                                snprintf(line, 
FILENAME_MAX,"#wlr.process:failed further parsing '%s':",path);
                                snprintf(wlr_error, FILENAME_MAX, "%.*s", 
FILENAME_MAX, line);
                                TRC_INFO(SQL_WLR, "%s\n", line);
-                               debugFunction(SQL_WLR, mb, 0, LIST_MAL_DEBUG );
+                               TRC_DEBUG_IF(SQL_WLR)
+                                       debugFunction(SQL_WLR, mb, 0, 
LIST_MAL_DEBUG );
                                cleanup();
                                TRC_DEBUG(SQL_WLR, "Redo transaction error\n");
                                continue;
                        }
                        q= getInstrPtr(mb, mb->stop - 1);
                        if( getModuleId(q) != wlrRef){
-                               TRC_DEBUG(SQL_WLR, "Unexpected instruction");
-                               debugInstruction(SQL_WLR, mb, 0, q, mb->stop-1, 
LIST_MAL_ALL);
+                               TRC_DEBUG_IF(SQL_WLR)
+                               {
+                                       TRC_DEBUG_ENDIF(SQL_WLR, "Unexpected 
instruction");
+                                       debugInstruction(SQL_WLR, mb, 0, q, 
mb->stop-1, LIST_MAL_ALL);
+                               }
                                
                                cleanup();
                                break;
@@ -356,8 +360,11 @@ WLRprocessBatch(void *arg)
                                        if(mvc_trans(sql) < 0) {
                                                TRC_ERROR(SQL_WLR, "Allocation 
failure while starting the transaction\n");
                                        } else {
-                                               TRC_DEBUG(SQL_WLR, "Process a 
transaction\n");
-                                               debugFunction(SQL_WLR, mb, 0, 
LIST_MAL_DEBUG | LIST_MAL_MAPI );
+                                               TRC_DEBUG_IF(SQL_WLR)
+                                               {
+                                                       
TRC_DEBUG_ENDIF(SQL_WLR, "Process a transaction\n");
+                                                       debugFunction(SQL_WLR, 
mb, 0, LIST_MAL_DEBUG | LIST_MAL_MAPI );
+                                               }
 
                                                wlr_tag =  tag; // remember 
which transaction we executed
                                                snprintf(wlr_read, 
sizeof(wlr_read), "%s", tag_read);
@@ -375,7 +382,6 @@ WLRprocessBatch(void *arg)
                                                if( msg != MAL_SUCCEED){
                                                        // they should always 
succeed
                                                        msg 
=createException(MAL,"wlr.process", "batch %d:"LLFMT" :%s\n", i, tag, msg);
-                                                       
//debugFunction(SQL_WLR, mb, 0, LIST_MAL_DEBUG );
                                                        if((other = 
mvc_rollback(sql,0,NULL, false)) != MAL_SUCCEED) //an error was already 
established
                                                                GDKfree(other);
                                                } else
@@ -388,8 +394,6 @@ WLRprocessBatch(void *arg)
                                        char line[FILENAME_MAX];
                                        snprintf(line, 
FILENAME_MAX,"#wlr.process:typechecking failed '%s':\n",path);
                                        snprintf(wlr_error, FILENAME_MAX, "%s", 
line);
-                                       //TRC_INFO(SQL_WLR, "%s\n", line);
-                                       //debugFunction(SQL_WLR, mb, 0, 
LIST_MAL_DEBUG );
                                }
                                cleanup();
                                if ( wlr_tag + 1 == wlc_tag || tag == wlr_limit)
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -8978,10 +8978,14 @@ optimize_rel(mvc *sql, sql_rel *rel, int
        gp = (global_props) {.cnt = {0},};
        rel_properties(sql, &gp, rel);
 
-       int i;
-       for (i = 0; i < ddl_maxops; i++) {
-               if (gp.cnt[i]> 0)
-                       TRC_DEBUG(SQL_OPTIMIZER, "%s %d\n", 
op2string((operator_type)i), gp.cnt[i]);
+       /* CHECK */
+       TRC_DEBUG_IF(SQL_OPTIMIZER)
+       {
+               int i;
+               for (i = 0; i < ddl_maxops; i++) {
+                       if (gp.cnt[i]> 0)
+                               TRC_DEBUG_ENDIF(SQL_OPTIMIZER, "%s %d\n", 
op2string((operator_type)i), gp.cnt[i]);
+               }
        }
 
        if (level <= 0 && gp.cnt[op_select]) 
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2114,11 +2114,14 @@ flusher_should_run(void)
 
        bool do_it = (reason_to && !reason_not_to);
 
-       if (reason_to != flusher.reason_to || reason_not_to != 
flusher.reason_not_to) {
-               TRC_DEBUG(SQL_STORE, "Store flusher: %s, reason to flush: %s, 
reason not to: %s\n",
-                       do_it ? "flushing" : "not flushing",
-                       reason_to ? reason_to : "none",
-                       reason_not_to ? reason_not_to : "none");
+       TRC_DEBUG_IF(SQL_STORE)
+       {
+               if (reason_to != flusher.reason_to || reason_not_to != 
flusher.reason_not_to) {
+                       TRC_DEBUG_ENDIF(SQL_STORE, "Store flusher: %s, reason 
to flush: %s, reason not to: %s\n",
+                                                                               
do_it ? "flushing" : "not flushing",
+                                                                               
reason_to ? reason_to : "none",
+                                                                               
reason_not_to ? reason_not_to : "none");
+               }
        }
 
        flusher.reason_to = reason_to;
@@ -4370,8 +4373,12 @@ reset_changeset(sql_trans *tr, changeset
                        } else if (fb->id < pfb->id) {  
                                node *t = n->next;
 
-                               sql_base *b = n->data;
-                               TRC_DEBUG(SQL_STORE, "Free: %s\n", (b->name) ? 
b->name : "help");
+                               TRC_DEBUG_IF(SQL_STORE)
+                               {
+                                       sql_base *b = n->data;
+                                       TRC_DEBUG_ENDIF(SQL_STORE, "Free: 
%s\n", (b->name) ? b->name : "help");
+                               }
+
                                cs_remove_node(fs, n);
                                n = t;
                        } else { /* a new id */
@@ -4391,8 +4398,12 @@ reset_changeset(sql_trans *tr, changeset
                }
                while ( ok == LOG_OK && n) { /* remove remaining old stuff */
                        node *t = n->next;
-                       sql_base *b = n->data;
-                       TRC_DEBUG(SQL_STORE, "Free: %s\n", (b->name) ? b->name 
: "help");
+                       
+                       TRC_DEBUG_IF(SQL_STORE)
+                       {
+                               sql_base *b = n->data;
+                               TRC_DEBUG_ENDIF(SQL_STORE, "Free: %s\n", 
(b->name) ? b->name : "help");
+                       }
 
                        cs_remove_node(fs, n);
                        n = t;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to