Changeset: 605c4525b4bc for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=605c4525b4bc
Added Files:
        monetdb5/extras/crackers/crackers_selectpl_ops.mx
Modified Files:
        monetdb5/extras/crackers/Makefile.ag
        monetdb5/extras/crackers/crackers.mx
        monetdb5/extras/crackers/crackers_holistic.c
        monetdb5/extras/crackers/crackers_selecthol_ops.mx
        monetdb5/extras/crackers/crackers_selectholpl_ops.mx
        monetdb5/extras/crackers/crackers_selectholst_ops.mx
        monetdb5/extras/crackers/crackers_selectst_ops.mx
        monetdb5/mal/mal_profiler.c
Branch: holindex
Log Message:

Concurrency control in db cracking.


diffs (truncated from 1707 to 300 lines):

diff --git a/monetdb5/extras/crackers/Makefile.ag 
b/monetdb5/extras/crackers/Makefile.ag
--- a/monetdb5/extras/crackers/Makefile.ag
+++ b/monetdb5/extras/crackers/Makefile.ag
@@ -45,6 +45,7 @@ lib_crackers = {
                          crackers_selecthol_ops.mx \
                          crackers_selectholst_ops.mx \
                          crackers_selectholpl_ops.mx \
+                         crackers_selectpl_ops.mx \
                          crackers_updates.mx \
                          crackers_sideways.mx \
                          crackers_sidewayshol.mx \
diff --git a/monetdb5/extras/crackers/crackers.mx 
b/monetdb5/extras/crackers/crackers.mx
--- a/monetdb5/extras/crackers/crackers.mx
+++ b/monetdb5/extras/crackers/crackers.mx
@@ -383,6 +383,45 @@ address CRKthetaselectholpl_@2
 comment "Retrieve the subset using a cracker
         index producing preferably a BATview.";
 
+command selectpl(b:bat[:oid,:@2],l:@2,h:@2):bat[:oid,:@2]
+address CRKselectpl_@2
+comment "Retrieve the subset using a cracker
+        index producing preferably a BATview.";
+
+command selectpl(b:bat[:oid,:@2],l:@2):bat[:oid,:@2]
+address CRKselectplValue_@2
+comment "Retrieve the subset using a cracker
+        index producing preferably a BATview.";
+
+command selectpl(b:bat[:oid,:@2],l:@2,h:@2,li:bit,hi:bit):bat[:oid,:@2]
+address CRKselectplBounds_@2
+comment "Retrieve the subset using a cracker
+        index producing preferably a BATview.";
+
+command uselectpl(b:bat[:any_1,:@2],l:@2,h:@2):bat[:any_1,:void]
+address CRKuselectpl_@2
+comment "Retrieve the subset using a cracker
+        index producing preferably a BATview.";
+
+command uselectpl(b:bat[:any_1,:@2],l:@2):bat[:any_1,:void]
+address CRKuselectplValue_@2
+comment "Retrieve the subset using a cracker
+        index producing preferably a BATview.";
+
+command uselectpl(b:bat[:any_1,:@2],l:@2,h:@2,li:bit,hi:bit):bat[:any_1,:void]
+address CRKuselectplBounds_@2
+comment "Retrieve the subset using a cracker
+        index producing preferably a BATview.";
+
+command thetauselectpl(b:bat[:any_1,:@2],v:@2,op:str):bat[:any_1,:void]
+address CRKthetauselectpl_@2
+comment "Retrieve the subset using a cracker
+        index producing preferably a BATview.";
+
+command thetaselectpl(b:bat[:any_1,:@2],v:@2,op:str):bat[:any_1,:@2]
+address CRKthetaselectpl_@2
+comment "Retrieve the subset using a cracker
+        index producing preferably a BATview.";
 @
 @= JoinSelect
 command joinuselect( right:bat[:oid,:@2], l:@2, h:@2, li:bit, hi:bit, 
left:bat[:oid,:void] ):bat[:oid,:void]
@@ -826,6 +865,10 @@ comment "Calculate aggregate sum of rang
 command sumholpl(b:bat[:any_1,:@2],l:@2,h:@2,li:bit,hi:bit):@2
 address CRKsumholplBounds_@2
 comment "Calculate aggregate sum of range l-h.";
+
+command sumpl(b:bat[:any_1,:@2],l:@2,h:@2,li:bit,hi:bit):@2
+address CRKsumplBounds_@2
+comment "Calculate aggregate sum of range l-h.";
 @
 
 @h
@@ -856,6 +899,7 @@ comment "Calculate aggregate sum of rang
 #include "crackers_selecthol_ops.h"
 #include "crackers_selectholst_ops.h"
 #include "crackers_selectholpl_ops.h"
+#include "crackers_selectpl_ops.h"
 #include "crackers_holistic.h"
 #include "crackers_holisticsideways.h"
 #include "crackers_core_unordered.h"
diff --git a/monetdb5/extras/crackers/crackers_holistic.c 
b/monetdb5/extras/crackers/crackers_holistic.c
--- a/monetdb5/extras/crackers/crackers_holistic.c
+++ b/monetdb5/extras/crackers/crackers_holistic.c
@@ -27,7 +27,7 @@
 static FrequencyNode *_InternalFrequencyStructA = NULL;
 static FrequencyNode *_InternalFrequencyStructB = NULL;
 static MT_Lock frequencylock;
-static MT_Id idletime_thread;
+//static MT_Id idletime_thread;
 MT_Lock CRKIndexLock;
 pthread_rwlock_t CRKFirstPieceRWLock;
 
@@ -41,7 +41,7 @@ CRKinitHolistic(int *ret)
        IdleFunc=&CRKrandomCrack;
        MT_lock_init(&frequencylock, "FrequencyStruct");
        MT_lock_init(&CRKIndexLock, "Cracker Index Lock");
-       MT_create_thread(&idletime_thread,(void (*)(void *))HeartbeatCPUload, 
IdleFunc, MT_THR_JOINABLE);
+       //MT_create_thread(&idletime_thread,(void (*)(void *))HeartbeatCPUload, 
IdleFunc, MT_THR_JOINABLE);
        *ret = 0;
        return MAL_SUCCEED;
 }
diff --git a/monetdb5/extras/crackers/crackers_selecthol_ops.mx 
b/monetdb5/extras/crackers/crackers_selecthol_ops.mx
--- a/monetdb5/extras/crackers/crackers_selecthol_ops.mx
+++ b/monetdb5/extras/crackers/crackers_selecthol_ops.mx
@@ -314,18 +314,18 @@ createView:
        bit copy=TRUE;
        int countBatElements=0;
        int L1=0; /*Number of elements that can fit into L1 cache (size: 32KB)*/
-       /*FILE *ofp;
-       char outputFilename1[] = 
"/export/scratch2/petraki/experiments_paper1/thresholds/client1/waiting01/cpuload70/idletime4/breakdown.txt";*/
+       FILE *ofp;
+       char outputFilename1[] = 
"/export/scratch2/petraki/experiments_paper1/thresholds/client1/waiting01/cpuload70/idletime4/breakdown.txt";
        FrequencyNode* FN;
        FrequencyNode *FrequencyStructA = getFrequencyStruct('A');
 
        gettimeofday(&tv0,0);
 
-       /*ofp = fopen(outputFilename1,"a");
+       ofp = fopen(outputFilename1,"a");
        if (ofp == NULL) {
                fprintf(stderr, "Can't open output file!\n");
                exit(1);
-       }*/
+       }
 
        if ((bo = BATdescriptor(*bid)) != NULL)
                L1=32000/ATOMsize(bo->ttype);   
@@ -660,12 +660,12 @@ createView:
                MT_lock_unset(&CrackerIndex[m].columnLock,"Lock Attribute");    
 
        gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
-       /*if(*isIdleQuery==FALSE)
+       if(*isIdleQuery==FALSE)
                fprintf(ofp,"User_query \t 1 \t Wait_time\t %9.6lf \t 
Selection_time\t %9.6lf\n",wt,ct);
        else
                fprintf(ofp,"Idle_Query \t 0 \t Wait_time\t %9.6lf \t 
Selection_time\t %9.6lf\n",wt,ct);
 
-       fclose(ofp);*/
+       fclose(ofp);
 
        return MAL_SUCCEED;
 @
diff --git a/monetdb5/extras/crackers/crackers_selectholpl_ops.mx 
b/monetdb5/extras/crackers/crackers_selectholpl_ops.mx
--- a/monetdb5/extras/crackers/crackers_selectholpl_ops.mx
+++ b/monetdb5/extras/crackers/crackers_selectholpl_ops.mx
@@ -315,7 +315,7 @@ createView:
        int countBatElements=0;
        int L1=0; /*Number of elements that can fit into L1 cache (size: 
32KB)*/        
        FILE *ofp;
-       char outputFilename1[] = 
"/export/scratch2/petraki/experiments_paper1/thresholds/client1/waiting0/multiple_clients/breakdown.txt";
+       char outputFilename1[] = 
"/export/scratch2/petraki/experiments_paper1/thresholds/client1/waiting001/cpuload40/breakdown.txt";
        FrequencyNode* FN;
        FrequencyNode *FrequencyStructA = getFrequencyStruct('A');
 
@@ -366,8 +366,6 @@ createView:
                        m = newCrackerIndex_@1(*bid,b->batCacheid);
 
                        countBatElements=BATcount(b);
-                       /*fprintf(stderr,"BATcount(b)=%d",countBatElements);*/
-                                                       
 
                        if ((c = BATdescriptor(CrackerIndex[m].cid)) == NULL)
                                throw(MAL, "crackers.crackRange", "Cannot 
access crack index");
@@ -396,7 +394,7 @@ createView:
                        BBPincref(b->batCacheid,TRUE);
                        BBPunfix(bo->batCacheid);
                        gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
-                       fprintf(stderr,"Wait time: %9.6lf Selection time: 
%9.6lf\n",wt,ct);
+                       //fprintf(stderr,"Wait time: %9.6lf Selection time: 
%9.6lf\n",wt,ct);
                        goto tempcreateView;
                }
                else{
@@ -679,9 +677,6 @@ createView:
        }
 
 
-       /*fprintf(ofp,"%d\n",FN->c);
-       fclose(ofp);*/
-
        /*@:CreateResult()@*/
        
        tempcreateView:;
@@ -730,9 +725,9 @@ createView:
        }
 
        if(*isIdleQuery==FALSE)
-               fprintf(ofp,"User_query \t 1 \t Wait_time\t %9.6lf \t 
Selection_time\t %9.6lf\n",wt,ct);
+               fprintf(ofp,"User_query \t 1 \t Wait_time\t %9.6lf \t 
Selection_time\t %9.6lf \t Low= \t %d \t High= \t 
%d\n",wt,ct,(int)*low,(int)*hgh);
        else
-               fprintf(ofp,"Idle_Query \t 0 \t Wait_time\t %9.6lf \t 
Selection_time\t %9.6lf\n",wt,ct);
+               fprintf(ofp,"Idle_Query \t 0 \t Wait_time\t %9.6lf \t 
Selection_time\t %9.6lf \t Low= \t %d \t High= \t 
%d\n",wt,ct,(int)*low,(int)*hgh);
 
        fclose(ofp);
 
diff --git a/monetdb5/extras/crackers/crackers_selectholst_ops.mx 
b/monetdb5/extras/crackers/crackers_selectholst_ops.mx
--- a/monetdb5/extras/crackers/crackers_selectholst_ops.mx
+++ b/monetdb5/extras/crackers/crackers_selectholst_ops.mx
@@ -331,10 +331,6 @@ createView:
 
        int L1=0; /*Number of elements that can fit into L1 cache (size: 32KB)*/
        
-       FILE *ofp;
-       char outputFilename1[] = 
"/export/scratch2/petraki/experiments_1st_paper/experiments/stochastic/idle_time_2/pieces_stholistic.txt";
-       
-
        FrequencyNode* FN;
        FrequencyNode *FrequencyStructA = getFrequencyStruct('A');
        FN=searchBAT(FrequencyStructA,*bid);
@@ -344,13 +340,6 @@ createView:
                FN->f1 = FN->f1 + 1;
        //}
 
-       ofp = fopen(outputFilename1,"a");
-       if (ofp == NULL) {
-               fprintf(stderr, "Can't open output file!\n");
-               exit(1);
-       }
-
-       
        if ((bo = BATdescriptor(*bid)) != NULL)
                L1=32000/ATOMsize(bo->ttype);
 
@@ -402,8 +391,6 @@ createView:
                        FN->c = FN->c + 2;
                        FN->weight = changeWeight_1(FN,countBatElements,L1);
                        /*printFrequencyStruct(FrequencyStructA);*/
-                       fprintf(ofp,"%d\n",FN->c);
-                       fclose(ofp);
                        BBPincref(b->batCacheid,TRUE);
                        BBPunfix(bo->batCacheid);
                        goto createView;
@@ -672,8 +659,6 @@ index then we have to crack */
                deleteNode(FrequencyStructA,FN->bid);
        */
        /*printFrequencyStruct(FrequencyStructA);*/
-       fprintf(ofp,"%d\n",FN->c);
-       fclose(ofp);
        @:CreateResult()@
        return MAL_SUCCEED;
 @
diff --git a/monetdb5/extras/crackers/crackers_selectpl_ops.mx 
b/monetdb5/extras/crackers/crackers_selectpl_ops.mx
new file mode 100644
--- /dev/null
+++ b/monetdb5/extras/crackers/crackers_selectpl_ops.mx
@@ -0,0 +1,1279 @@
+@/
+The contents of this file are subject to the MonetDB Public License
+Version 1.1 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+http://www.monetdb.org/Legal/MonetDBLicense
+
+Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+License for the specific language governing rights and limitations
+under the License.
+
+The Original Code is the MonetDB Database System.
+
+The Initial Developer of the Original Code is CWI.
+Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+Copyright August 2008-2013 MonetDB B.V.
+All Rights Reserved.
+@
+
+@f crackers_selectpl_ops
+
+@c
+/*
+ * @a Martin Kersten, Stratos Idreos, Stefan Manegold, Eleni Petraki
+ * @d March 2006 - July 2007
+ * @* Select Operators
+ *
+ *
+ * @+ Interface
+ *
+ *
+ * @- Type expansion
+ */
+@= TypeSwitch
+@:@1(sht,simple,,sht)@
+@:@1(int,simple,,int)@
+@:@1(lng,simple,,lng)@
+@:@1(flt,simple,,flt)@
+@:@1(dbl,simple,,dbl)@
+@:@1(date,atom,TYPE_,loc)@
+@
+@h
+/*
+ * @- Header file
+ */
+#ifndef _CRACKERS_SELECTPL_H_
+#define _CRACKERS_SELECTPL_H_
+
+#define dt(a,b) (b.tv_sec - a.tv_sec + (b.tv_usec - a.tv_usec) * 1e-6)
+
+/* Exported signatures */
+@:TypeSwitch(SelectplFunctions_decl)@
+
+#endif /* _CRACKERS_SELECTPL_H */
+/*
+ * @- Exported signatures
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to