Changeset: 71debb3365a4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=71debb3365a4
Added Files:
        sql/test/BugTracker-2013/Tests/not_null.Bug-3403.sql
        sql/test/BugTracker-2013/Tests/not_null.Bug-3403.stable.err
        sql/test/BugTracker-2013/Tests/not_null.Bug-3403.stable.out
Modified Files:
        clients/mapiclient/tomograph.c
        gdk/gdk_utils.c
        monetdb5/mal/mal_dataflow.c
        monetdb5/mal/mal_interpreter.c
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_profiler.h
        monetdb5/modules/kernel/alarm.c
        sql/backends/monet5/sql.c
        sql/server/rel_exp.c
        sql/server/rel_exp.h
        sql/server/rel_optimizer.c
        sql/server/rel_planner.c
        sql/server/rel_planner.h
        sql/server/rel_psm.c
        sql/server/rel_psm.h
        sql/server/rel_select.c
        sql/test/BugTracker-2013/Tests/All
        sql/test/BugTracker-2013/Tests/between.Bug-3259.stable.out
Branch: default
Log Message:

Merge with Jan2014 branch.


diffs (truncated from 753 to 300 lines):

diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c
--- a/clients/mapiclient/tomograph.c
+++ b/clients/mapiclient/tomograph.c
@@ -301,6 +301,7 @@ activateBeat(void)
 #define ACTION 2
 #define PING 4
 #define WAIT 5
+#define GCOLLECT 6
 
 typedef struct BOX {
        int row;
@@ -1336,12 +1337,10 @@ gnuplotheader(char *filename)
        fprintf(gnudata, "set tics front\n");
        tm = time(0);
        date = ctime(&tm);
-       if (strchr(date, (int) '\n'))
-               *strchr(date, (int) '\n') = 0;
        for (c = title; c && *c; c++)
                if (*c == '_')
                        *c = '-';
-       fprintf(gnudata, "set title \"%s\t\t%s\"\n", (title ? title : 
"Tomogram"), date);
+       fprintf(gnudata, "set title \"%s\t\t%.24s\"\n", (title ? title : 
"Tomogram"), date);
        fprintf(gnudata, "set multiplot\n");
 }
 
@@ -1509,6 +1508,11 @@ createTomogram(void)
                        case WAIT:
                                fprintf(gnudata, "set object %d rectangle from 
"LLFMT".0, %d to %f,%f front fillcolor rgb \"red\" fillstyle solid 1.0\n",
                                        object++, box[i].clkstart, box[i].row * 
2 * h+h-h/3, box[i].clkstart + w /50.0, box[i].row *2 *h + 1.3 * h);
+                               break;
+                       case GCOLLECT:
+                               fprintf(gnudata, "set object %d rectangle from 
"LLFMT".0, %d to "LLFMT".0,%f front fillcolor rgb \"green\" fillstyle solid 
1.0\n",
+                                       object++, box[i].clkstart, box[i].row * 
2 * h+h-h/3, box[i].clkend, box[i].row *2 *h + 1.3 * h);
+                               break;
                        }
 
 
@@ -1653,6 +1657,8 @@ update(int state, int thread, lng clktic
                box[idx].thread = thread;
                lastclk[thread] = clkticks;
                box[idx].clkend = box[idx].clkstart = clkticks;
+               if (state == GCOLLECT)
+                       box[idx].clkstart -= ticks;
                box[idx].memend = box[idx].memstart = memory;
                box[idx].footstart = box[idx].footend = footprint;
                box[idx].reads = reads;
@@ -1758,6 +1764,9 @@ parser(char *row)
        } else if (strncmp(c + 1, "wait", 4) == 0) {
                state = WAIT;
                c += 5;
+       } else if (strncmp(c + 1, "gcollect", 8) == 0) {
+               state = GCOLLECT;
+               c += 9;
        } else {
                state = 0;
                c = strchr(c + 1, (int) '"');
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -197,6 +197,10 @@ GDKlog(const char *format, ...)
        char *p = 0, buf[1024];
        int mustopen = GDKgetHome();
        time_t tm = time(0);
+#if defined(HAVE_CTIME_R3) || defined(HAVE_CTIME_R)
+       char tbuf[26];
+#endif
+       char *ctm;
 
        if (MT_pagesize() == 0)
                return;
@@ -215,7 +219,16 @@ GDKlog(const char *format, ...)
 #ifndef HAVE_GETUID
 #define getuid() 0
 #endif
-       fprintf(GDKlockFile, "USR=%d PID=%d TIME=%.24s @ %s\n", (int) getuid(), 
(int) getpid(), ctime(&tm), buf);
+#ifdef HAVE_CTIME_R3
+       ctm = ctime_r(&tm, tbuf, sizeof(tbuf));
+#else
+#ifdef HAVE_CTIME_R
+       ctm = ctime_r(&tm, tbuf);
+#else
+       ctm = ctime(&tm);
+#endif
+#endif
+       fprintf(GDKlockFile, "USR=%d PID=%d TIME=%.24s @ %s\n", (int) getuid(), 
(int) getpid(), ctm, buf);
        fflush(GDKlockFile);
 
        if (mustopen)
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -403,7 +403,7 @@ DFLOWworker(void *T)
                q_enqueue(flow->done, fe);
                if ( fnxt == 0) {
                        if (todo->last == 0)
-                               profilerHeartbeatEvent("wait");
+                               profilerHeartbeatEvent("wait", 0);
                }
        }
        GDKfree(GDKerrbuf);
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -793,6 +793,7 @@ str runMALsequence(Client cntxt, MalBlkP
 
                                /* general garbage collection */
                                if (ret == MAL_SUCCEED && garbageControl(pci)) {
+                                       lng u0 = GDKusec(), u1;
                                        for (i = 0; i < pci->argc; i++) {
                                                int a = getArg(pci, i);
 
@@ -827,6 +828,9 @@ str runMALsequence(Client cntxt, MalBlkP
                                                        }
                                                }
                                        }
+                                       u1 = GDKusec();
+                                       if (u1 - u0 > 100)
+                                               
profilerHeartbeatEvent("gcollect", u1 - u0);
                                }
                        }
 
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -207,12 +207,12 @@ deactivateCounter(str name)
  * It uses a local logbuffer[LOGLEN] and logbase, logtop, loglen
  */
 #define LOGLEN 8192
-#define lognew()  loglen = 0; logbase = logbuffer; *logbase = 0;\
+#define lognew()  loglen = 0; logbase = logbuffer; *logbase = 0;
 
-#define logadd(...)                                                            
                        \
-       do {                                                                    
                                        \
-               (void) snprintf(logbase+loglen, LOGLEN -1 - loglen, 
__VA_ARGS__);                                       \
-               loglen += (int) strlen(logbase+loglen);                         
        \
+#define logadd(...)                                                            
                                                \
+       do {                                                                    
                                                        \
+               (void) snprintf(logbase+loglen, LOGLEN -1 - loglen, 
__VA_ARGS__); \
+               loglen += (int) strlen(logbase+loglen);                         
                        \
        } while (0)
 
 static void logsend(char *logbuffer)
@@ -252,7 +252,7 @@ profilerEvent(int idx, MalBlkPtr mb, Mal
                return;
        p = getInstrPtr(mb,pc);
        if ( !start && p && p->token == ENDsymbol)
-               profilerHeartbeatEvent("ping");
+               profilerHeartbeatEvent("ping", 0);
        if (myname == 0)
                myname = putName("profiler", 8);
        if (getModuleId(getInstrPtr(mb, pc)) == myname)
@@ -401,22 +401,26 @@ offlineProfilerEvent(int idx, MalBlkPtr 
                }
        }
        if (profileCounter[PROFtime].status) {
-               char *tbuf, *c;
+               char *tbuf;
 
                /* without this cast, compilation on Windows fails with
                 * argument of type "long *" is incompatible with parameter of 
type "const time_t={__time64_t={__int64}} *"
                 */
                time_t clock = (time_t) mb->profiler[pc].clock.tv_sec;
+#ifdef HAVE_CTIME_R3
+               char ctm[26];
+               tbuf = ctime_r(&clock, ctm, sizeof(ctm));
+#else
+#ifdef HAVE_CTIME_R
+               char ctm[26];
+               tbuf = ctime_r(&clock, ctm);
+#else
                tbuf = ctime(&clock);
-               if (tbuf) {
-                       c = strchr(tbuf, '\n');
-                       if (c) {
-                               c[-5] = 0;
-                       }
-                       tbuf[10] = '"';
-                       logadd("%s", tbuf + 10);
-                       logadd(".%06d\",\t", 
(int)mb->profiler[pc].clock.tv_usec);
-               } else
+#endif
+#endif
+               if (tbuf)
+                       logadd("\"%.8s.%06ld\",\t", tbuf + 11, (long) 
mb->profiler[pc].clock.tv_usec);
+               else
                        logadd("%s,\t", "nil");
        }
        if (profileCounter[PROFthread].status) {
@@ -1146,16 +1150,25 @@ cachedProfilerEvent(int idx, MalBlkPtr m
        TRACE_event++;
 
        {
-               char *tbuf, *c;
+               char *tbuf;
 
                /* without this cast, compilation on Windows fails with
                 * argument of type "long *" is incompatible with parameter of 
type "const time_t={__time64_t={__int64}} *"
                 */
                time_t clock = (time_t) mb->profiler[pc].clock.tv_sec;
+#ifdef HAVE_CTIME_R3
+               char ctm[26];
+               tbuf = ctime_r(&clock, ctm, sizeof(ctm));
+#else
+#ifdef HAVE_CTIME_R
+               char ctm[26];
+               tbuf = ctime_r(&clock, ctm);
+#else
                tbuf = ctime(&clock);
-               c = strchr(tbuf, '\n');
-               if (c)
-                       snprintf(c-5, 6, ".%03d", 
(int)mb->profiler[pc].clock.tv_usec / 1000);
+#endif
+#endif
+               /* sneakily overwrite year with second fraction */
+               snprintf(tbuf + 19, 6, ".%03d", 
(int)mb->profiler[pc].clock.tv_usec / 1000);
                TRACE_id_time = BUNappend(TRACE_id_time, tbuf, FALSE);
        }
 
@@ -1377,7 +1390,7 @@ void profilerGetCPUStat(lng *user, lng *
        *iowait = corestat[255].iowait;
 }
 
-void profilerHeartbeatEvent(str msg)
+void profilerHeartbeatEvent(str msg, lng ticks)
 {
        char logbuffer[LOGLEN], *logbase;
        char cpuload[BUFSIZ];
@@ -1423,17 +1436,21 @@ void profilerHeartbeatEvent(str msg)
        if (profileCounter[PROFstart].status) 
                logadd("\"%s\",\t",msg);
        if (profileCounter[PROFtime].status) {
-               char *tbuf, *c;
+               char *tbuf;
+#ifdef HAVE_CTIME_R3
+               char ctm[26];
+               tbuf = ctime_r(&clock, ctm, sizeof(ctm));
+#else
+#ifdef HAVE_CTIME_R
+               char ctm[26];
+               tbuf = ctime_r(&clock, ctm);
+#else
                tbuf = ctime(&clock);
-               if (tbuf) {
-                       c = strchr(tbuf, '\n');
-                       if (c) {
-                               c[-5] = 0;
-                       }
-                       tbuf[10] = '"';
-                       logadd("%s", tbuf + 10);
-                       logadd(".%06d\",\t", (int)tv.tv_usec);
-               } else
+#endif
+#endif
+               if (tbuf)
+                       logadd("\"%.8s.%06ld\",\t", tbuf + 11, (long) 
tv.tv_usec);
+               else
                        logadd("%s,\t", "nil");
        }
        if (profileCounter[PROFthread].status)
@@ -1447,7 +1464,7 @@ void profilerHeartbeatEvent(str msg)
        if (profileCounter[PROFpc].status) 
                logadd("0,\t");
        if (profileCounter[PROFticks].status) 
-               logadd("0,\t");
+               logadd(LLFMT",\t", ticks);
 #ifdef HAVE_TIMES
        if (profileCounter[PROFcpu].status && delayswitch < 0) {
                logadd(LLFMT",\t", (lng) (newTms.tms_utime - 
prevtimer.tms_utime));
@@ -1517,7 +1534,7 @@ static void profilerHeartbeat(void *dumm
                        if (!hbrunning)
                                return;
                }
-               profilerHeartbeatEvent("ping");
+               profilerHeartbeatEvent("ping", 0);
        }
        hbdelay = 0;
 }
diff --git a/monetdb5/mal/mal_profiler.h b/monetdb5/mal/mal_profiler.h
--- a/monetdb5/mal/mal_profiler.h
+++ b/monetdb5/mal/mal_profiler.h
@@ -65,7 +65,7 @@ mal_export str closeProfilerStream(void)
 
 mal_export void initProfiler(MalBlkPtr mb);
 mal_export void profilerEvent(int idx, MalBlkPtr mb, MalStkPtr stk, int pc, 
int start);
-mal_export void profilerHeartbeatEvent(str msg);
+mal_export void profilerHeartbeatEvent(str msg, lng ticks);
 mal_export str setLogFile(stream *fd, Module cntxt, str fname);
 mal_export str setLogStream(Module cntxt, str host, int port);
 mal_export str setLogStreamStream(Module cntxt, stream *s);
diff --git a/monetdb5/modules/kernel/alarm.c b/monetdb5/modules/kernel/alarm.c
--- a/monetdb5/modules/kernel/alarm.c
+++ b/monetdb5/modules/kernel/alarm.c
@@ -181,19 +181,17 @@ str
 ALARMctime(str *res)
 {
        time_t t = time(0);
-       char *base, *c;
+       char *base;
 
 #ifdef HAVE_CTIME_R3
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to