Changeset: 3e431bad4d9a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3e431bad4d9a
Modified Files:
        common/stream/stream.c
        sql/backends/monet5/sql_execute.c
Branch: mlogger
Log Message:

Added Tracer -> stream.c (incomplete) & sql_execute.c


diffs (truncated from 399 to 300 lines):

diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -53,6 +53,7 @@
 #include "stream.h"
 #include "stream_socket.h"
 #include "matomic.h"
+#include "gdk_tracer.h"
 
 #include <string.h>
 #include <stddef.h>
@@ -363,7 +364,7 @@ mnstr_read(stream *restrict s, void *res
        if (s == NULL || buf == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "read %s %zu %zu\n",
+       Trace(M_DEBUG, "Read: %s %zu %zu\n",
                s->name ? s->name : "<unnamed>", elmsize, cnt);
 #endif
        assert(s->readonly);
@@ -383,7 +384,7 @@ mnstr_readline(stream *restrict s, void 
        if (s == NULL || buf == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "readline %s %zu\n",
+       Trace(M_DEBUG, "Readline: %s %zu\n",
                s->name ? s->name : "<unnamed>", maxcnt);
 #endif
        assert(s->readonly);
@@ -441,7 +442,7 @@ mnstr_write(stream *restrict s, const vo
        if (s == NULL || buf == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "write %s %zu %zu\n",
+       Trace(M_DEBUG, "Write: %s %zu %zu\n",
                s->name ? s->name : "<unnamed>", elmsize, cnt);
 #endif
        assert(!s->readonly);
@@ -466,7 +467,7 @@ mnstr_close(stream *s)
 {
        if (s) {
 #ifdef STREAM_DEBUG
-               fprintf(stderr, "close %s\n", s->name ? s->name : "<unnamed>");
+               Trace(M_DEBUG, "Close: %s\n", s->name ? s->name : "<unnamed>");
 #endif
                s->close(s);
        }
@@ -477,7 +478,7 @@ mnstr_destroy(stream *s)
 {
        if (s) {
 #ifdef STREAM_DEBUG
-               fprintf(stderr, "destroy %s\n",
+               Trace(M_DEBUG, "Destroy: %s\n",
                        s->name ? s->name : "<unnamed>");
 #endif
                s->destroy(s);
@@ -499,7 +500,7 @@ mnstr_flush(stream *s)
        if (s == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "flush %s\n", s->name ? s->name : "<unnamed>");
+       Trace(M_DEBUG, "Flush: %s\n", s->name ? s->name : "<unnamed>");
 #endif
        assert(!s->readonly);
        if (s->errnr)
@@ -516,7 +517,7 @@ mnstr_fsync(stream *s)
        if (s == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "fsync %s (%d)\n",
+       Trace(M_DEBUG, "Enter fsync: %s (%d)\n",
                s->name ? s->name : "<unnamed>", s->errnr);
 #endif
        assert(!s->readonly);
@@ -533,7 +534,7 @@ mnstr_fgetpos(stream *restrict s, fpos_t
        if (s == NULL || p == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "fgetpos %s\n", s->name ? s->name : "<unnamed>");
+       Trace(M_DEBUG, "Enter fgetpos: %s\n", s->name ? s->name : "<unnamed>");
 #endif
        if (s->errnr)
                return -1;
@@ -548,7 +549,7 @@ mnstr_fsetpos(stream *restrict s, fpos_t
        if (s == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "fsetpos %s\n", s->name ? s->name : "<unnamed>");
+       Trace(M_DEBUG, "Enter fsetpos: %s\n", s->name ? s->name : "<unnamed>");
 #endif
        if (s->errnr)
                return -1;
@@ -619,7 +620,7 @@ mnstr_set_bigendian(stream *s, bool bige
        if (s == NULL)
                return;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "mnstr_set_bigendian %s %s\n",
+       Trace(M_DEBUG, "Set stream to big-endian byte order: %s %s\n",
                s->name ? s->name : "<unnamed>",
                swapbytes ? "true" : "false");
 #endif
@@ -709,7 +710,7 @@ create_stream(const char *name)
                return NULL;
        }
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "create_stream %s -> %p\n",
+       Trace(M_DEBUG, "Enter create_stream: %s -> %p\n",
                name ? name : "<unnamed>", s);
 #endif
        return s;
@@ -2038,7 +2039,7 @@ open_rstream(const char *filename)
        if (filename == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "open_rstream %s\n", filename);
+       Trace(M_DEBUG, "Enter open_rstream: %s\n", filename);
 #endif
        ext = get_extension(filename);
 
@@ -2066,7 +2067,7 @@ open_wstream(const char *filename)
        if (filename == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "open_wstream %s\n", filename);
+       Trace(M_DEBUG, "Enter open_wstream: %s\n", filename);
 #endif
        ext = get_extension(filename);
 
@@ -2095,7 +2096,7 @@ open_rastream(const char *filename)
        if (filename == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "open_rastream %s\n", filename);
+       Trace(M_DEBUG, "Enter open_rastream: %s\n", filename);
 #endif
        ext = get_extension(filename);
 
@@ -2123,7 +2124,7 @@ open_wastream(const char *filename)
        if (filename == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "open_wastream %s\n", filename);
+       Trace(M_DEBUG, "Enter open_wastream: %s\n", filename);
 #endif
        ext = get_extension(filename);
 
@@ -2736,7 +2737,7 @@ socket_rstream(SOCKET sock, const char *
        stream *s = NULL;
 
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "socket_rstream %zd %s\n", (ssize_t) sock, name);
+       Trace(M_DEBUG, "Enter socket_rstream: %zd %s\n", (ssize_t) sock, name);
 #endif
        if ((s = socket_open(sock, name)) != NULL)
                s->binary = true;
@@ -2749,7 +2750,7 @@ socket_wstream(SOCKET sock, const char *
        stream *s;
 
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "socket_wstream %zd %s\n", (ssize_t) sock, name);
+       Trace(M_DEBUG, "Enter socket_wstream: %zd %s\n", (ssize_t) sock, name);
 #endif
        if ((s = socket_open(sock, name)) == NULL)
                return NULL;
@@ -3093,7 +3094,7 @@ file_rstream(FILE *restrict fp, const ch
        if (fp == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "file_rstream %s\n", name);
+       Trace(M_DEBUG, "Enter file_rstream: %s\n", name);
 #endif
        if ((s = file_stream(name)) == NULL)
                return NULL;
@@ -3110,7 +3111,7 @@ file_wstream(FILE *restrict fp, const ch
        if (fp == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "file_wstream %s\n", name);
+       Trace(M_DEBUG, "Enter file_wstream: %s\n", name);
 #endif
        if ((s = file_stream(name)) == NULL)
                return NULL;
@@ -3131,7 +3132,7 @@ file_rastream(FILE *restrict fp, const c
        if (fp == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "file_rastream %s\n", name);
+       Trace(M_DEBUG, "Enter file_rastream: %s\n", name);
 #endif
        if ((s = file_stream(name)) == NULL)
                return NULL;
@@ -3202,7 +3203,7 @@ file_wastream(FILE *restrict fp, const c
        if (fp == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "file_wastream %s\n", name);
+       Trace(M_DEBUG, "Enter file_wastream: %s\n", name);
 #endif
        if ((s = file_stream(name)) == NULL)
                return NULL;
@@ -3574,7 +3575,7 @@ iconv_rstream(stream *restrict ss, const
        if (ss == NULL || charset == NULL || name == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "iconv_rstream %s %s\n", charset, name);
+       Trace(M_DEBUG, "Enter iconv_rstream: %s %s\n", charset, name);
 #endif
        if (ss->isutf8)
                return ss;
@@ -3600,7 +3601,7 @@ iconv_wstream(stream *restrict ss, const
        if (ss == NULL || charset == NULL || name == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "iconv_wstream %s %s\n", charset, name);
+       Trace(M_DEBUG, "Enter iconv_wstream: %s %s\n", charset, name);
 #endif
        if (ss->isutf8)
                return ss;
@@ -3791,7 +3792,7 @@ buffer_rastream(buffer *restrict b, cons
        if (b == NULL || name == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "buffer_rastream %s\n", name);
+       Trace(M_DEBUG, "Enter buffer_rastream: %s\n", name);
 #endif
        if ((s = create_stream(name)) == NULL)
                return NULL;
@@ -3812,7 +3813,7 @@ buffer_wastream(buffer *restrict b, cons
        if (b == NULL || name == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       fprintf(stderr, "buffer_wastream %s\n", name);
+       Trace(M_DEBUG, "Enter buffer_wastream: %s\n", name);
 #endif
        if ((s = create_stream(name)) == NULL)
                return NULL;
@@ -3895,13 +3896,13 @@ bs_write(stream *restrict ss, const void
                        {
                                unsigned i;
 
-                               fprintf(stderr, "W %s %u \"", ss->name, s->nr);
+                               Trace(M_DEBUG, "Write: %s %u \"  HERE  \"\n", 
ss->name, s->nr);
+
                                for (i = 0; i < s->nr; i++)
                                        if (' ' <= s->buf[i] && s->buf[i] < 127)
                                                putc(s->buf[i], stderr);
                                        else
                                                fprintf(stderr, "\\%03o", 
s->buf[i]);
-                               fprintf(stderr, "\"\n");
                        }
 #endif
                        /* since the block is at max BLOCK (8K) - 2 size we can
@@ -3948,14 +3949,13 @@ bs_flush(stream *ss)
                if (s->nr > 0) {
                        unsigned i;
 
-                       fprintf(stderr, "W %s %u \"", ss->name, s->nr);
+                       Trace(M_DEBUG, "Flush: %s %u \"  HERE  \"\n", ss->name, 
s->nr);
+
                        for (i = 0; i < s->nr; i++)
                                if (' ' <= s->buf[i] && s->buf[i] < 127)
                                        putc(s->buf[i], stderr);
                                else
                                        fprintf(stderr, "\\%03o", s->buf[i]);
-                       fprintf(stderr, "\"\n");
-                       fprintf(stderr, "W %s 0\n", ss->name);
                }
 #endif
                blksize = (uint16_t) (s->nr << 1);
@@ -4030,8 +4030,8 @@ bs_read(stream *restrict ss, void *restr
                        return -1;
                }
 #ifdef BSTREAM_DEBUG
-               fprintf(stderr, "RC size: %u, final: %s\n", (uint16_t) blksize 
>> 1, (uint16_t) blksize & 1 ? "true" : "false");
-               fprintf(stderr, "RC %s %u\n", ss->name, (uint16_t) blksize);
+               Trace(M_DEBUG, "RC size: %u, final: %s\n", (uint16_t) blksize 
>> 1, (uint16_t) blksize & 1 ? "true" : "false");
+               Trace(M_DEBUG, "RC %s %u\n", ss->name, (uint16_t) blksize);
 #endif
                s->itotal = (uint16_t) blksize >> 1;    /* amount readable */
                /* store whether this was the last block or not */
@@ -4057,14 +4057,13 @@ bs_read(stream *restrict ss, void *restr
                        {
                                ssize_t i;
 
-                               fprintf(stderr, "RD %s %zd \"", ss->name, m);
+                               Trace(M_DEBUG, "Read: %s %zd \"  HERE  \"\n", 
ss->name, m, );
+
                                for (i = 0; i < m; i++)
-                                       if (' ' <= ((char *) buf)[i] &&
-                                           ((char *) buf)[i] < 127)
+                                       if (' ' <= ((char *) buf)[i] && ((char 
*) buf)[i] < 127)
                                                putc(((char *) buf)[i], stderr);
                                        else
                                                fprintf(stderr, "\\%03o", 
((char *) buf)[i]);
-                               fprintf(stderr, "\"\n");
                        }
 #endif
                        buf = (void *) ((char *) buf + m);
@@ -4096,9 +4095,8 @@ bs_read(stream *restrict ss, void *restr
                                return -1;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to