Changeset: 83a9cbbb1939 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=83a9cbbb1939 Added Files: sql/test/malloc_fail/Tests/mallocs.SQL.py sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.sql sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.err sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out Removed Files: sql/test/malloc_fail/Tests/initialize.sql sql/test/malloc_fail/Tests/initialize.stable.err sql/test/malloc_fail/Tests/initialize.stable.out sql/test/malloc_fail/Tests/setmemorylimit-fail.reqtests sql/test/malloc_fail/Tests/setmemorylimit-fail.sql sql/test/malloc_fail/Tests/setmemorylimit-fail.stable.err sql/test/malloc_fail/Tests/setmemorylimit-fail.stable.out sql/test/malloc_fail/Tests/setmemorylimit-fail2.reqtests sql/test/malloc_fail/Tests/setmemorylimit-fail2.sql sql/test/malloc_fail/Tests/setmemorylimit.reqtests sql/test/malloc_fail/Tests/setmemorylimit.sql sql/test/malloc_fail/Tests/setmemorylimit.stable.err sql/test/malloc_fail/Tests/setmemorylimit.stable.out Modified Files: configure.ag gdk/gdk_system.c gdk/gdk_utils.c gdk/gdk_utils.h monetdb5/mal/Tests/performanceTests/performanceLog monetdb5/mal/Tests/performanceTests/tst400d.malC monetdb5/mal/Tests/performanceTests/tst901a.malC monetdb5/mal/Tests/performanceTests/tst901b.malC monetdb5/mal/mal.h monetdb5/mal/mal_builder.c monetdb5/mal/mal_exception.c monetdb5/mal/mal_function.c monetdb5/mal/mal_instruction.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_profiler.c monetdb5/mal/mal_runtime.c monetdb5/mal/mal_stack.c monetdb5/modules/mal/mal_io.c monetdb5/modules/mal/mal_io.h monetdb5/modules/mal/mal_io.mal monetdb5/optimizer/opt_mergetable.c monetdb5/optimizer/opt_reorder.c sql/backends/monet5/UDF/pyapi/Tests/pyapi_types_string.stable.out sql/backends/monet5/UDF/pyapi/type_conversion.c sql/backends/monet5/UDF/pyapi/unicode.c sql/backends/monet5/UDF/pyapi/unicode.h sql/backends/monet5/sql_optimizer.c sql/test/malloc_fail/Tests/All sql/test/sys-schema/Tests/All testing/Mtest.py.in Branch: wlcr Log Message:
merge with default diffs (truncated from 2046 to 300 lines): diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -2561,6 +2561,7 @@ AC_CHECK_FUNCS([\ asctime_r \ backtrace \ cbrt \ + clock_gettime \ ctime_r \ fabsf \ fallocate \ diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c --- a/gdk/gdk_system.c +++ b/gdk/gdk_system.c @@ -895,16 +895,34 @@ GDKusec(void) return (lng) (((ctr.QuadPart - start.QuadPart) * 1000000) / freq.QuadPart); } #endif +#ifdef HAVE_CLOCK_GETTIME +#if defined(CLOCK_UPTIME_FAST) +#define CLK_ID CLOCK_UPTIME_FAST /* FreeBSD */ +#else +#define CLK_ID CLOCK_MONOTONIC /* Posix (fallback) */ +#endif + { + static struct timespec tsbase; + struct timespec ts; + if (tsbase.tv_sec == 0) { + clock_gettime(CLK_ID, &tsbase); + return tsbase.tv_nsec / 1000; + } + if (clock_gettime(CLK_ID, &ts) == 0) + return (ts.tv_sec - tsbase.tv_sec) * 1000000 + ts.tv_nsec / 1000; + } +#endif #ifdef HAVE_GETTIMEOFDAY { static struct timeval tpbase; /* automatically initialized to 0 */ struct timeval tp; - if (tpbase.tv_sec == 0) + if (tpbase.tv_sec == 0) { gettimeofday(&tpbase, NULL); + return (lng) tpbase.tv_usec; + } gettimeofday(&tp, NULL); - tp.tv_sec -= tpbase.tv_sec; - return (lng) tp.tv_sec * 1000000 + (lng) tp.tv_usec; + return (lng) (tp.tv_sec - tpbase.tv_sec) * 1000000 + (lng) tp.tv_usec; } #else #ifdef HAVE_FTIME @@ -912,11 +930,12 @@ GDKusec(void) static struct timeb tbbase; /* automatically initialized to 0 */ struct timeb tb; - if (tbbase.time == 0) + if (tbbase.time == 0) { ftime(&tbbase); + return (lng) tbbase.millitm * 1000; + } ftime(&tb); - tb.time -= tbbase.time; - return (lng) tb.time * 1000000 + (lng) tb.millitm * 1000; + return (lng) (tb.time - tbbase.time) * 1000000 + (lng) tb.millitm * 1000; } #endif #endif diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -319,7 +319,7 @@ int GDK_vm_trim = 1; #include "gdk_atomic.h" static volatile ATOMIC_TYPE GDK_mallocedbytes_estimate = 0; #ifndef NDEBUG -static volatile lng GDK_mallocedbytes_limit = -1; +static volatile lng GDK_malloc_success_count = -1; #endif static volatile ATOMIC_TYPE GDK_vm_cursize = 0; #ifdef GDK_VM_KEEPHISTO @@ -1639,12 +1639,17 @@ GDKmalloc_prefixsize(size_t size) return s; } +#ifndef NDEBUG +static MT_Lock mallocsuccesslock; +#endif + void -GDKsetmemorylimit(lng nbytes) +GDKsetmallocsuccesscount(lng count) { - (void) nbytes; + (void) count; #ifndef NDEBUG - GDK_mallocedbytes_limit = nbytes; + MT_lock_init(&mallocsuccesslock, "mallocsuccesslock"); + GDK_malloc_success_count = count; #endif } @@ -1668,10 +1673,15 @@ GDKmallocmax(size_t size, size_t *maxsiz } #ifndef NDEBUG /* fail malloc for testing purposes depending on set limit */ - if (GDK_mallocedbytes_limit >= 0 && - size > (size_t) GDK_mallocedbytes_limit) { + if (GDK_malloc_success_count > 0) { + MT_lock_set(&mallocsuccesslock); + if (GDK_malloc_success_count > 0) GDK_malloc_success_count--; + MT_lock_unset(&mallocsuccesslock); + } + if (GDK_malloc_success_count == 0) { return NULL; } + #endif size = (size + 7) & ~7; /* round up to a multiple of eight */ s = GDKmalloc_prefixsize(size); diff --git a/gdk/gdk_utils.h b/gdk/gdk_utils.h --- a/gdk/gdk_utils.h +++ b/gdk/gdk_utils.h @@ -77,7 +77,7 @@ gdk_export void MT_init(void); /* init gdk_export int GDKinit(opt *set, int setlen); /* used for testing only */ -gdk_export void GDKsetmemorylimit(lng nbytes); +gdk_export void GDKsetmallocsuccesscount(lng count); /* * Upon closing the session, all persistent BATs should be saved and diff --git a/monetdb5/mal/Tests/performanceTests/performanceLog b/monetdb5/mal/Tests/performanceTests/performanceLog --- a/monetdb5/mal/Tests/performanceTests/performanceLog +++ b/monetdb5/mal/Tests/performanceTests/performanceLog @@ -1218,7 +1218,7 @@ tst901a 1.315/0.651/0.595 tst901b 1.313/1.222/0.016 ======================== 20 mar 2013 =================== Vienna Fedora 18 -Default release +Default branch The compilation mode for is --enable-optimize --disable-debug compilation took ? command: time mserver5 TST </dev/null >/dev/null @@ -1233,7 +1233,7 @@ tst901a 0.655/0.409/0.038 tst901b 1.417/1.100/0.038 ======================== 12 oct 2014 =================== Vienna Fedora 20 -Default release +Default branch The compilation mode for is --enable-optimize --disable-debug compilation took ? command: time mserver5 TST </dev/null >/dev/null @@ -1248,7 +1248,7 @@ tst901a 0.812/0.750/0.032 tst901b 2.112/2.051/0.038 ======================== 23 apr 2015 =================== Vienna Fedora 20 -Default release +Default branch The compilation mode for is --enable-optimize --disable-debug compilation took ? command: time mserver5 TST </dev/null >/dev/null @@ -1261,3 +1261,32 @@ tst400e 1.006/0.986/0.020 tst901a 0.790/0.760/0.030 tst901b 2.053/2.016/0.037 +======================== 6 jan 2017 =================== +Vienna Fedora 25 +Default branch +The compilation mode for is --enable-optimize --disable-debug +command: time mserver5 TST </dev/null >/dev/null +base 0.280/0.185/0.016 +tst400a 0.295/0.273/0.011 +tst400bHuge 0.324/0.281/0.031 +tst400cHuge 0.276/0.226/0.026 +tst400d 0.647/0.620/0.016 +tst400e 1.097/1.060/0.019 + +tst901a 0.777/0.736/0.030 +tst901b 1.777/1.744/0.023 +======================== 6 jan 2017 =================== +Vienna Fedora 25 +Default branch +After fixing the timing. +The compilation mode for is --enable-optimize --disable-debug +command: time mserver5 TST </dev/null >/dev/null +base 0.220/0.183/0.022 +tst400a 0.298/0.281/0.015 +tst400bHuge 0.323/0.291/0.021 +tst400cHuge 0.225/0.194/0.013 +tst400d 0.651/0.625/0.016 +tst400e 1.074/1.063/0.010 + +tst901a 0.800/0.776/0.018 +tst901b 1.848/1.812/0.023 diff --git a/monetdb5/mal/Tests/performanceTests/tst400d.malC b/monetdb5/mal/Tests/performanceTests/tst400d.malC --- a/monetdb5/mal/Tests/performanceTests/tst400d.malC +++ b/monetdb5/mal/Tests/performanceTests/tst400d.malC @@ -1,9 +1,9 @@ # simple iterator loop test - b:= bat.new(:oid,:int); -barrier i:= 0:lng; - z:= bat.append(b,1); - redo i:= iterator.next(1:lng,1000000:lng); + b:= bat.new(:int); +barrier i:= 0:int; + bat.append(b,1); + redo i:= iterator.next(1:int,1000000:int); exit i; c:= aggr.count(b); io.print(c); diff --git a/monetdb5/mal/Tests/performanceTests/tst901a.malC b/monetdb5/mal/Tests/performanceTests/tst901a.malC --- a/monetdb5/mal/Tests/performanceTests/tst901a.malC +++ b/monetdb5/mal/Tests/performanceTests/tst901a.malC @@ -1,5 +1,5 @@ # what is the overhead of MAL in multiplex situations -b:= bat.new(:oid,:lng); +b:= bat.new(:lng); t0:= alarm.usec(); barrier i:= 0:lng; o:= calc.oid(i); diff --git a/monetdb5/mal/Tests/performanceTests/tst901b.malC b/monetdb5/mal/Tests/performanceTests/tst901b.malC --- a/monetdb5/mal/Tests/performanceTests/tst901b.malC +++ b/monetdb5/mal/Tests/performanceTests/tst901b.malC @@ -1,6 +1,6 @@ # what is the overhead of MAL in multiplex situations # using a BATloop !! This is 40x slower as the V4.3 multiplex implementation -b:= bat.new(:oid,:lng); +b:= bat.new(:lng); t0:= alarm.usec(); barrier i:= 0:lng; o:= calc.oid(i); @@ -10,7 +10,7 @@ exit i; t1:= alarm.usec(); c:= algebra.copy(b); t2:= alarm.usec(); -d:= bat.new(:oid,:lng); +d:= bat.new(:lng); barrier (h,t):= iterator.new(b); zz:= algebra.fetch(b,h); z:= algebra.fetch(c,h); diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h --- a/monetdb5/mal/mal.h +++ b/monetdb5/mal/mal.h @@ -176,7 +176,7 @@ typedef struct { struct MALBLK *blk; /* resolved MAL function address */ int mitosis; /* old mtProp value */ /* inline statistics */ - struct timeval clock; /* when the last call was started */ + lng clock; /* when the last call was started */ lng ticks; /* total micro seconds spent in last call */ int calls; /* number of calls made to this instruction */ lng totticks; /* total time spent on this instruction. */ diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c --- a/monetdb5/mal/mal_builder.c +++ b/monetdb5/mal/mal_builder.c @@ -108,6 +108,10 @@ newComment(MalBlkPtr mb, const char *val } cst.len= (int) strlen(cst.val.sval); getArg(q,0) = defConstant(mb,TYPE_str,&cst); + if (getArg(q,0) < 0) { + freeInstruction(q); + return NULL; + } clrVarConstant(mb,getArg(q,0)); setVarDisabled(mb,getArg(q,0)); if (mb->errors) { diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c --- a/monetdb5/mal/mal_exception.c +++ b/monetdb5/mal/mal_exception.c @@ -57,7 +57,10 @@ createExceptionInternal(enum malexceptio { char *message; int len; - + // if there is an error we allow memory allocation once again +#ifndef NDEBUG + GDKsetmallocsuccesscount(-1); +#endif message = GDKmalloc(GDKMAXERRLEN); if (message == NULL) return M5OutOfMemory; /* last resort */ diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c --- a/monetdb5/mal/mal_function.c +++ b/monetdb5/mal/mal_function.c @@ -34,12 +34,12 @@ Symbol newFunction(str mod, str nme,int } p = newInstruction(NULL,mod,nme); - p->token = kind; - p->barrier = 0; if (p == NULL) { freeSymbol(s); return NULL; } + p->token = kind; + p->barrier = 0; setDestVar(p, varid); pushInstruction(s->def,p); return s; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list