Changeset: 295b8f009a1a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=295b8f009a1a
Modified Files:
monetdb5/extras/crackers/crackers_selecthol_ops.mx
monetdb5/extras/crackers/crackers_selectholpl_ops.mx
Branch: holindex
Log Message:
Add time measurements.
diffs (227 lines):
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
@@ -74,6 +74,8 @@ crackers_export str CRKthetauselecthol_@
#include "monetdb_config.h"
#include "crackers.h"
+#define dt(a,b) (b.tv_sec - a.tv_sec + (b.tv_usec - a.tv_usec) * 1e-6)
+
/* Local support functions and macros */
@:TypeSwitch(crackOperations)@
@@ -302,7 +304,8 @@ createView:
bit rippledDeletions = FALSE;
struct Node *lowNode=NULL, *hghNode=NULL, *lowNodeNext=NULL, *temp;
BUN idxFirst;
-
+ struct timeval tv0, tv1;
+ double wt=0, ct=0;
bit copy=TRUE;
int countBatElements=0;
@@ -326,8 +329,13 @@ createView:
if ((bo = BATdescriptor(*bid)) != NULL)
L1=32000/ATOMsize(bo->ttype);
+
+ gettimeofday(&tv0,0);
+
MT_lock_set(&CRKIndexLock,"Cracker Index Lock");
+ gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+
/*if (@2_GT(low,hgh,@3@1))
throw(MAL, "crackers.crack", "illegal range");*/
@@ -388,6 +396,9 @@ createView:
printFrequencyStruct(FrequencyStructA);
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);
goto createView;
}
else{
@@ -431,6 +442,7 @@ createView:
MT_lock_unset(&CRKIndexLock,"Cracker Index Lock");
MT_lock_set(&CrackerIndex[m].columnLock,"Lock Attribute");
+ gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
FN=searchBAT(FrequencyStructA,*bid);
@@ -629,6 +641,8 @@ createView:
/*fprintf(ofp,"%d\n",FN->c);
fclose(ofp);*/
+ gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
+ fprintf(stderr,"Wait time: %9.6lf Selection time: %9.6lf\n",wt,ct);
@:CreateResult()@
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
@@ -46,6 +46,8 @@ All Rights Reserved.
#ifndef _CRACKERS_SELECTHOLPL_H_
#define _CRACKERS_SELECTHOLPL_H_
+#define dt(a,b) (b.tv_sec - a.tv_sec + (b.tv_usec - a.tv_usec) * 1e-6)
+
/* Exported signatures */
@:TypeSwitch(SelectholplFunctions_decl)@
@@ -302,19 +304,18 @@ createView:
struct Node *lowNode=NULL, *hghNode=NULL, *lowNodeNext=NULL, *temp;
BUN idxFirst;
int firstRetry=0;
-
- bit copy=TRUE;
-
+ struct timeval tv0, tv1;
+ double wt=0, ct=0;
+ bit copy=TRUE;
int countBatElements=0;
- int L1=0; /*Number of elements that can fit into L1 cache (size: 32KB)*/
-
+ 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_holistic.txt";*/
-
-
FrequencyNode* FN;
FrequencyNode *FrequencyStructA = getFrequencyStruct('A');
+
+ gettimeofday(&tv0,0);
if ((bo = BATdescriptor(*bid)) != NULL)
L1=32000/ATOMsize(bo->ttype);
@@ -325,9 +326,10 @@ createView:
exit(1);
}*/
-
+
MT_lock_set(&CRKIndexLock,"Cracker Index Lock");
+ gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
/*if (@2_GT(low,hgh,@3@1))
throw(MAL, "crackers.crack", "illegal range");*/
@@ -389,6 +391,8 @@ createView:
/*printFrequencyStruct(FrequencyStructA);*/
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);
goto tempcreateView;
}
else{
@@ -515,11 +519,14 @@ createView:
MT_lock_unset(&CRKIndexLock,"Cracker Index Lock");
-
+ gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
+
retry:;
pthread_rwlock_rdlock(&CrackerIndex[m].columnRWLock);
+ gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+
FN=searchBAT(FrequencyStructA,*bid);
if ((*isIdleQuery==FALSE)&&(firstRetry==0))
@@ -575,29 +582,30 @@ createView:
ch2 -= holsHgh;
}
-
-
- /* If one or both of the result view bounds were not found using the
- index then we have to crack */
-
+ gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
/* If one or both of the result view bounds were not found using the
index then we have to crack */
if (foundLow == 0 || foundHgh == 0) {
if (foundLow == 0) {
pthread_rwlock_rdlock(&CrackerIndex[m].columnRWLock);
+ gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
lowNode = findNodeL_@1(*low, TRUE,
CrackerIndex[m].Tree, c, idxFirst, NULL);
plock = (lowNode == NULL)? &CRKFirstPieceRWLock :
&lowNode->pieceLock;
if (pthread_rwlock_trywrlock(plock)){
pthread_rwlock_unlock(&CrackerIndex[m].columnRWLock);
+ gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
pthread_rwlock_wrlock(plock);
+ gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
pthread_rwlock_unlock(plock);
firstRetry=1;
goto retry; // some other thread might
already crack on low, try to find it again
}
pthread_rwlock_unlock(&CrackerIndex[m].columnRWLock);
@:crkTwoLTree@5(@1,@5)@
+ gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
pthread_rwlock_wrlock(&CrackerIndex[m].columnRWLock);
+ gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
t = (int *) Tloc(b, BUNfirst(b));
if (IndexSize < IndexStop) {
if (vl > 0)
@@ -619,20 +627,26 @@ createView:
pthread_rwlock_unlock(&CrackerIndex[m].columnRWLock);
pthread_rwlock_unlock(plock);
}
+ gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
if (foundHgh == 0) {
pthread_rwlock_rdlock(&CrackerIndex[m].columnRWLock);
+ gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
lowNode = findNodeL_@1(*hgh, TRUE,
CrackerIndex[m].Tree, c, idxFirst, NULL);
plock = (lowNode == NULL)? &CRKFirstPieceRWLock :
&lowNode->pieceLock;
if (pthread_rwlock_trywrlock(plock)){
pthread_rwlock_unlock(&CrackerIndex[m].columnRWLock);
+ gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
pthread_rwlock_wrlock(plock);
+ gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
pthread_rwlock_unlock(plock);
firstRetry=1;
goto retry; // some other thread might
already crack on low, try to find it again
}
pthread_rwlock_unlock(&CrackerIndex[m].columnRWLock);
@:crkTwoRTree@5(@1,@5)@
+ gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
pthread_rwlock_wrlock(&CrackerIndex[m].columnRWLock);
+ gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
t = (int *) Tloc(b, BUNfirst(b));
if (IndexSize < IndexStop)
if (gapH>0)
@@ -665,12 +679,16 @@ createView:
fclose(ofp);*/
/*@:CreateResult()@*/
-
+
tempcreateView:;
posh = BUNlast(b)-1;
idxFirst = BUNfirst(c);
+
+ gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
+
pthread_rwlock_rdlock(&CrackerIndex[m].columnRWLock);
+ gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
lowNode = findNodeL_@1(*low, *inclusiveLow, CrackerIndex[m].Tree, c,
idxFirst, NULL);
if (lowNode == NULL){
lowNodeNext = NULL;
@@ -690,6 +708,7 @@ createView:
hghNode = lowNodeNext;
vh = hghNode? hghNode->indexPosition : posh;
pthread_rwlock_unlock(&CrackerIndex[m].columnRWLock);
+ gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list