Update of /cvsroot/monetdb/MonetDB5/src/optimizer
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv32295/src/optimizer

Modified Files:
        opt_statistics.mx 
Log Message:
Merged GDK-2 branch into development branch.

Current changes were mostly started for
fixing the void concurrency problem

As a side action, the bun/bat layout was also changed.
We now have a split head and tail. This means many of the well known
macros are changed (ie BUN{h,t}{loc,var} BUN{head,tail})

BAT iteration now needs a special struct
BATiter which can be correctly created as

BATiter bi = bat_iterator(b);


TODO
        1 some modules aren't ported (maybe be dropped as they aren't used)

        2 some more bugs to find


Next improvements which are now possible
        views based on 2 bats
        (or a bat where head is real and the tail a view (or vs))
        many more....

For a presentation about the changes, see
http://www.cwi.nl/~niels/download/gdk2.pdf


Index: opt_statistics.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_statistics.mx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- opt_statistics.mx   28 Sep 2007 11:48:49 -0000      1.11
+++ opt_statistics.mx   4 Oct 2007 10:37:39 -0000       1.12
@@ -92,7 +92,7 @@
 static void QOTstatisticsInit(){
        oid o=0;
 
-       if( qotStat[QOTnames]) return;
+       if (qotStat[QOTnames]) return;
        qotStat[QOTnames]= QOT_create("opt","names",TYPE_void,TYPE_str);
        BATseqbase(qotStat[QOTnames],o);
        qotStat[QOTcalls]= QOT_create("opt","calls",TYPE_void,TYPE_int);
@@ -109,6 +109,7 @@
 void
 QOTupdateStatistics(str nme, int actions, lng val)
 {
+       BATiter bi;
        BUN p;
        oid idx;
        int ival=0, *ip= &ival;
@@ -118,8 +119,8 @@
 #ifdef _Q_STATISTICS_DEBUG
        stream_printf(GDKout,"update optimizer statistics\n");
 #endif
-       p= BUNfnd(BATmirror(qotStat[QOTnames]),(ptr)nme);
-       if( p == 0) {
+       p = BUNfnd(BATmirror(qotStat[QOTnames]),(ptr)nme);
+       if (p == BUN_NONE) {
 #ifdef _Q_STATISTICS_DEBUG
                stream_printf(GDKout,"initialized? %d\n",qotStat[QOTnames]==0);
                stream_printf(GDKout,"insert optimizer statistics %s\n",nme);
@@ -128,34 +129,37 @@
                BUNappend(qotStat[QOTcalls],  &ival, FALSE);
                BUNappend(qotStat[QOTactions], &ival, FALSE);
                BUNappend(qotStat[QOTtimings], &lval, FALSE);
-               p= BUNfnd(BATmirror(qotStat[QOTnames]),(ptr)nme);
-               if(p==0){
+               p = BUNfnd(BATmirror(qotStat[QOTnames]),(ptr)nme);
+               if (p == BUN_NONE){
 #ifdef _Q_STATISTICS_DEBUG
                        stream_printf(GDKout,"not found\n");
 #endif
                        return;
                }
        } 
-       idx= *(oid*) BUNhead(qotStat[QOTnames],p);
+       bi = bat_iterator(qotStat[QOTnames]);
+       idx = *(oid*) BUNhead(bi,p);
 
-       p= BUNfnd(qotStat[QOTcalls],&idx);
-       if( p== NULL)
+       p = BUNfnd(qotStat[QOTcalls],&idx);
+       if (p == BUN_NONE)
                stream_printf(GDKout,"#Could not access 'calls'\n");
+       bi = bat_iterator(qotStat[QOTcalls]);
+       ip = (int*) BUNtail(bi,p);
+       *ip = *ip+1;
 
-       ip= (int*) BUNtail(qotStat[QOTcalls],p);
-       *ip= *ip+1;
-
-       p= BUNfnd(qotStat[QOTactions],&idx);
-       if( p== NULL)
+       p = BUNfnd(qotStat[QOTactions],&idx);
+       if (p == BUN_NONE)
                stream_printf(GDKout,"#Could not access 'actions'\n");
-       ip= (int*) BUNtail(qotStat[QOTactions],p);
-       *ip= *ip+ actions;
+       bi = bat_iterator(qotStat[QOTactions]);
+       ip = (int*) BUNtail(bi,p);
+       *ip = *ip+ actions;
 
-       p= BUNfnd(qotStat[QOTtimings],&idx);
-       if( p== NULL)
+       p = BUNfnd(qotStat[QOTtimings],&idx);
+       if (p == BUN_NONE)
                stream_printf(GDKout,"#Could not access 'timings'\n");
-       lp= (lng*) BUNtail(qotStat[QOTtimings],p);
-       *lp= *lp+ val;
+       bi = bat_iterator(qotStat[QOTtimings]);
+       lp = (lng*) BUNtail(bi,p);
+       *lp = *lp+ val;
 }
 
 void


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to