Changeset: a67f74967a5f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a67f74967a5f
Modified Files:
        
Branch: Oct2010
Log Message:

merge


diffs (294 lines):

diff -r 08a374b2bf43 -r a67f74967a5f MonetDB/src/gdk/gdk_logger.mx
--- a/MonetDB/src/gdk/gdk_logger.mx     Mon Sep 06 23:09:17 2010 +0200
+++ b/MonetDB/src/gdk/gdk_logger.mx     Mon Sep 06 23:09:34 2010 +0200
@@ -1008,13 +1008,13 @@
        BUN p, q;
        /* using alloca, since the old TMsubcommit interface also uses
           alloca */
-       bat *n = alloca(sizeof(bat) * (1 + BATcount(list) * 2 + (extra ? 
BATcount(extra) : 0)));
+       bat *n = alloca(sizeof(bat) * (2 + BATcount(list) * 2 + (extra ? 
BATcount(extra) : 0)));
        int i = 0;
        BAT *b = list;
        BATiter bi = bat_iterator(b);
        int res;
 
-       n[i++] = 0;
+       n[i++] = 0;             /* n[0] is not used */
 
        /* first loop over deleted then over current and new */
        for (p = b->batDeleted; p < b->batFirst; p++) {
diff -r 08a374b2bf43 -r a67f74967a5f MonetDB/src/gdk/gdk_utils.mx
--- a/MonetDB/src/gdk/gdk_utils.mx      Mon Sep 06 23:09:17 2010 +0200
+++ b/MonetDB/src/gdk/gdk_utils.mx      Mon Sep 06 23:09:34 2010 +0200
@@ -39,7 +39,6 @@
 gdk_export lng GDKusec(void);
 gdk_export int GDKms(void);
 
-gdk_export int gdk_alloc_map;
 gdk_export BAT *GDKenv;
 
 @c
@@ -47,9 +46,9 @@
 
 #include "gdk.h"
 
-int gdk_alloc_map = 0;
-char GDKdbfarmStr[PATHLENGTH] = { "dbfarm" };
-char GDKdbnameStr[PATHLENGTH] = { 0 };
+static int gdk_alloc_map = 0;
+static char GDKdbfarmStr[PATHLENGTH] = { "dbfarm" };
+static char GDKdbnameStr[PATHLENGTH] = { 0 };
 
 BAT *GDKenv = NULL;
 
@@ -1452,7 +1451,7 @@
 gdk_export int GDKrecovery;
 
 @c
-int GDKtime_startsec, GDKrecovery = 0;
+int GDKrecovery = 0;
 
 @h
 gdk_export int GDKinit(opt *set, int setlen);
@@ -1593,24 +1592,6 @@
 #endif
        GDKlockHome();
 
-       /* init time */
-#ifdef HAVE_GETTIMEOFDAY
-       {
-               struct timeval tp;
-
-               gettimeofday(&tp, NULL);
-               GDKtime_startsec = tp.tv_sec;
-       }
-#else
-#ifdef HAVE_FTIME
-       {
-               struct timeb tb;
-
-               ftime(&tb);
-               GDKtime_startsec = (int) tb.time;
-       }
-#endif
-#endif
        /* Mserver by default takes 80% of all memory as a default */
        GDK_mem_maxsize_max = (size_t) ((double) MT_npages() * (double) 
MT_pagesize() * 0.815);
        GDK_mmap_minsize = GDK_mem_maxsize = GDK_mem_maxsize_max;
@@ -2176,17 +2157,44 @@
 lng
 GDKusec(void)
 {
+       /* Return the time in milliseconds since an epoch.  The epoch
+          is roughly the time this program started. */
+#ifdef HAVE_QUERYPERFORMANCECOUNTER
+       static LARGE_INTEGER freq, start;       /* automatically initialized to 
0 */
+       LARGE_INTEGER ctr;
+
+       if (start.QuadPart == 0 &&
+           (!QueryPerformanceFrequency(&freq) ||
+            !QueryPerformanceCounter(&start)))
+               start.QuadPart = -1;
+       if (start.QuadPart > 0) {
+               QueryPerformanceCounter(&ctr);
+               return (lng) (((ctr.QuadPart - start.QuadPart) * 1000000) / 
freq.QuadPart);
+       }
+#endif
 #ifdef HAVE_GETTIMEOFDAY
-       struct timeval tp;
+       {
+               static struct timeval tpbase;   /* automatically initialized to 
0 */
+               struct timeval tp;
 
-       gettimeofday(&tp, NULL);
-       return ((lng) (tp.tv_sec - GDKtime_startsec)) * LL_CONSTANT(1000000) + 
(lng) tp.tv_usec;
+               if (tpbase.tv_sec == 0)
+                       gettimeofday(&tpbase, NULL);
+               gettimeofday(&tp, NULL);
+               tp.tv_sec -= tpbase.tv_sec;
+               return (lng) tp.tv_sec * 1000000 + (lng) tp.tv_usec;
+       }
 #else
 #ifdef HAVE_FTIME
-       struct timeb tb;
+       {
+               static struct timeb tbbase;     /* automatically initialized to 
0 */
+               struct timeb tb;
 
-       ftime(&tb);
-       return ((lng) (tb.time - GDKtime_startsec)) * LL_CONSTANT(1000000) + 
((lng) tb.millitm) * LL_CONSTANT(1000);
+               if (tbbase.time == 0)
+                       ftime(&tbbase);
+               ftime(&tb);
+               tb.time -= tbbase.time;
+               return (lng) tb.time * 1000000 + (lng) tb.millitm * 1000;
+       }
 #endif
 #endif
 }
@@ -2195,19 +2203,7 @@
 int
 GDKms(void)
 {
-#ifdef HAVE_GETTIMEOFDAY
-       struct timeval tp;
-
-       gettimeofday(&tp, NULL);
-       return (tp.tv_sec - GDKtime_startsec) * 1000 + tp.tv_usec / 1000;
-#else
-#ifdef HAVE_FTIME
-       struct timeb tb;
-
-       ftime(&tb);
-       return (int) ((tb.time - GDKtime_startsec) * 1000 + tb.millitm);
-#endif
-#endif
+       return (int) (GDKusec() / 1000);
 }
 
 @}
diff -r 08a374b2bf43 -r a67f74967a5f MonetDB5/src/mal/Tests/tst274.stable.out
--- a/MonetDB5/src/mal/Tests/tst274.stable.out  Mon Sep 06 23:09:17 2010 +0200
+++ b/MonetDB5/src/mal/Tests/tst274.stable.out  Mon Sep 06 23:09:34 2010 +0200
@@ -84,11 +84,11 @@
 # void lng     lng       # type
 #-------------------------#
 [ 0...@0,        0,      0       ]
-[ 1...@0,        0,      160000  ]
+[ 1...@0,        0,      120000  ]
 [ 2...@0,        0,      0       ]
 [ 3...@0,        0,      0       ]
-[ 4...@0,        160000, 160000  ]
-[ 5...@0,        0,      160000  ]
+[ 4...@0,        120000, 120000  ]
+[ 5...@0,        0,      120000  ]
 [ 6...@0,        0,      0       ]
 
 # 17:57:29 >  
diff -r 08a374b2bf43 -r a67f74967a5f MonetDB5/src/mal/mal_instruction.mx
--- a/MonetDB5/src/mal/mal_instruction.mx       Mon Sep 06 23:09:17 2010 +0200
+++ b/MonetDB5/src/mal/mal_instruction.mx       Mon Sep 06 23:09:34 2010 +0200
@@ -1659,8 +1659,7 @@
        InstrPtr q;
        int actions;
 
-       vars= (int *) alloca(mb->vtop * sizeof(int));
-       memset((char*) vars, 0, mb->vtop * sizeof(int));
+       vars= (int *) GDKzalloc(mb->vtop * sizeof(int));
 
        /* build the alias table */
        for (i = 0; i < mb->vtop; i++) {
@@ -1714,6 +1713,8 @@
        mnstr_printf(GDKout, "After reduction \n");
        printFunction(GDKout,mb,0,0);
 #endif
+       if (vars)
+               GDKfree(vars);
        mb->vtop = cnt;
 }
 void
diff -r 08a374b2bf43 -r a67f74967a5f MonetDB5/src/modules/mal/tokenizer.mx
--- a/MonetDB5/src/modules/mal/tokenizer.mx     Mon Sep 06 23:09:17 2010 +0200
+++ b/MonetDB5/src/modules/mal/tokenizer.mx     Mon Sep 06 23:09:34 2010 +0200
@@ -148,7 +148,7 @@
 #endif
 
 #define COMP(h, d) ((h<<8)|(d&255))
-#define GET_d(x) ((x)&255)
+#define GET_d(x) ((sht)((x)&255))
 #define GET_h(x) ((x)>>8)
 
 str
diff -r 08a374b2bf43 -r a67f74967a5f buildtools/conf/winconfig.h
--- a/buildtools/conf/winconfig.h       Mon Sep 06 23:09:17 2010 +0200
+++ b/buildtools/conf/winconfig.h       Mon Sep 06 23:09:34 2010 +0200
@@ -358,6 +358,9 @@
 /* Define to 1 if you have the <pwd.h> header file. */
 /* #undef HAVE_PWD_H */
 
+/* Define to 1 if you have the `QueryPerformanceCounter' function. */
+#define HAVE_QUERYPERFORMANCECOUNTER 1
+
 /* Define to 1 if you have the <regex.h> header file. */
 /* #undef HAVE_REGEX_H */
 
diff -r 08a374b2bf43 -r a67f74967a5f clients/NT/clients_config.h.in
--- a/clients/NT/clients_config.h.in    Mon Sep 06 23:09:17 2010 +0200
+++ b/clients/NT/clients_config.h.in    Mon Sep 06 23:09:34 2010 +0200
@@ -29,9 +29,6 @@
 /* Define to 1 if you have the <odbcinst.h> header file. */
 #define HAVE_ODBCINST_H 1
 
-/* Define to 1 if you have the `QueryPerformanceCounter' function. */
-#define HAVE_QUERYPERFORMANCECOUNTER 1
-
 /* Define to 1 if you have the `SQLGetPrivateProfileString' function. */
 #define HAVE_SQLGETPRIVATEPROFILESTRING 1
 
diff -r 08a374b2bf43 -r a67f74967a5f testing/src/Mtest.py.in
--- a/testing/src/Mtest.py.in   Mon Sep 06 23:09:17 2010 +0200
+++ b/testing/src/Mtest.py.in   Mon Sep 06 23:09:34 2010 +0200
@@ -1030,7 +1030,7 @@
     if THISFILE == "Mtest.py":
         if env.has_key('GDK_DBFARM'):
             LogDBdir = os.path.join(env['GDK_DBFARM'],TSTDB)
-            if LogDBdir and os.path.exists(LogDBdir):
+            if not env.get('NOCLEAN') and LogDBdir and 
os.path.exists(LogDBdir):
                 try:
                     shutil.rmtree(LogDBdir)
                 except:
@@ -3085,6 +3085,7 @@
              "echo differences between stable and current test output to 
console (stdout)"),
             ('mserver_set', None, 'mserver_set', '<Mserver_option>',
              "This passes a single set to the server"),
+            ('no-clean', None, 'no_clean', None, 'Do not clean up before 
test'),
             ]
 
     if THISFILE == 'Mtest.py':
@@ -3218,6 +3219,9 @@
             env['MSERVER_SET'] = "--set " + a
         else:
             env['MSERVER_SET'] = ""
+        a = opts.get('no_clean')
+        if a is not None:
+            env['NOCLEAN'] = a
     if THISFILE == 'Mapprove.py':
         a = opts.get('ext')
         if a is None:
@@ -3595,7 +3599,7 @@
                 if os.path.isfile(f):
                     shutil.copy(f,"C:"+os.sep+"Tools")
 
-        if os.path.exists(os.path.join(env['TSTTRGBASE'],TSTPREF)):
+        if not env.get('NOCLEAN') and 
os.path.exists(os.path.join(env['TSTTRGBASE'],TSTPREF)):
             try:
                 shutil.rmtree(os.path.join(env['TSTTRGBASE'],TSTPREF))
             except:
@@ -3608,17 +3612,22 @@
                 #TODO: set mode to umask
                 os.makedirs(env['XRPC_DOCROOT'])
 
-        if os.path.exists(os.path.join(env['GDK_DBFARM'],TSTPREF)):
+        if not env.get('NOCLEAN') and 
os.path.exists(os.path.join(env['GDK_DBFARM'],TSTPREF)):
             try:
                 shutil.rmtree(os.path.join(env['GDK_DBFARM'],TSTPREF))
             except:
                 ErrXit("Failed to remove %s" % 
os.path.join(env['GDK_DBFARM'],TSTPREF))
         try:
             os.makedirs(os.path.join(env['GDK_DBFARM'],TSTPREF))
-        except:
-            ErrXit("Failed to create %s" % 
os.path.join(env['GDK_DBFARM'],TSTPREF))
-
-        os.makedirs(os.path.join(env['TSTTRGBASE'],TSTPREF))
+        except os.error:
+            if not env.get('NOCLEAN'):
+                ErrXit("Failed to create %s" % 
os.path.join(env['GDK_DBFARM'],TSTPREF))
+
+        try:
+            os.makedirs(os.path.join(env['TSTTRGBASE'],TSTPREF))
+        except os.error:
+            if not env.get('NOCLEAN'):
+                ErrXit("Failed to create %s" % 
os.path.join(env['TSTTRGBASE'],TSTPREF))
 
         # write .monetdb file for mclient to do authentication with
         dotmonetdbfile = os.path.join(env['TSTTRGBASE'], ".monetdb")
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to