Changeset: 026b97651ee1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=026b97651ee1
Modified Files:
monetdb5/extras/crackers/crackers_selectpl_ops.mx
Branch: holindex
Log Message:
Print timestamps for each thread.
diffs (234 lines):
diff --git a/monetdb5/extras/crackers/crackers_selectpl_ops.mx
b/monetdb5/extras/crackers/crackers_selectpl_ops.mx
--- a/monetdb5/extras/crackers/crackers_selectpl_ops.mx
+++ b/monetdb5/extras/crackers/crackers_selectpl_ops.mx
@@ -302,14 +302,27 @@ createView:
bit rippledDeletions = FALSE;
struct Node *lowNode=NULL, *hghNode=NULL, *lowNodeNext=NULL, *temp;
BUN idxFirst;
- struct timeval tv0, tv1;
- double wt=0, ct=0;
+ //struct timeval tv0, tv1;
+ //double wt=0, ct=0;
bit copy=TRUE;
- FILE *ofp;
+ FILE *ofp,*file;
char *outputFilename1;
+ char filename[150];
+ lng t0 = GDKusec();
- gettimeofday(&tv0,0);
-
+
+ //gettimeofday(&tv0,0);
+
+ snprintf (filename, sizeof(filename),
"/export/scratch2/petraki/experiments_paper1/concurrency/multiple_clients/select/%d.txt",
getpid());
+
+ file = fopen(filename,"a");
+ if (file == NULL) {
+ fprintf(stderr, "Can't open thread file!\n");
+ exit(1);
+ }
+ fprintf(file,"timestamp=\t" LLFMT "\t0\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+
outputFilename1 = getenv("SELECT_PL");
if (outputFilename1 == NULL){
fprintf(stderr, "Error: SELECT_PL\n");
@@ -323,9 +336,17 @@ createView:
}
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
+
MT_lock_set(&CRKIndexLock,"Cracker Index Lock");
- gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ //gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+
/*if (@2_GT(low,hgh,@3@1))
throw(MAL, "crackers.crack", "illegal range");*/
@@ -373,7 +394,7 @@ createView:
/*printFrequencyStruct(FrequencyStructA);*/
BBPincref(b->batCacheid,TRUE);
BBPunfix(bo->batCacheid);
- gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
+ //gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
goto tempcreateView;
}
else{
@@ -499,14 +520,23 @@ createView:
MT_lock_unset(&CRKIndexLock,"Cracker Index Lock");
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
- gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
-
+ //gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
retry:;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
pthread_rwlock_rdlock(&CrackerIndex[m].columnRWLock);
- gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+
+ //gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
/* find out where in the index the low falls */
foundLow = GetLow_@1(*low, *inclusiveLow, CrackerIndex[m].Tree, c,
BUNfirst(c), &cl1, &ch1, 0, BUNlast(b)-(oid)1,&LBound);
@@ -554,29 +584,47 @@ createView:
ch2 -= holsHgh;
}
- gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
+ //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) {
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
pthread_rwlock_rdlock(&CrackerIndex[m].columnRWLock);
- gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ //gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
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;
+ //gettimeofday(&tv1,0); ct+=dt(tv0,tv1);
tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
pthread_rwlock_wrlock(plock);
- gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ //gettimeofday(&tv1,0); wt+=dt(tv0,tv1);
tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
pthread_rwlock_unlock(plock);
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;
+ //gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
pthread_rwlock_wrlock(&CrackerIndex[m].columnRWLock);
- gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+ //gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
t = (int *) Tloc(b, BUNfirst(b));
if (IndexSize < IndexStop) {
if (vl > 0)
@@ -592,25 +640,44 @@ createView:
pthread_rwlock_unlock(&CrackerIndex[m].columnRWLock);
pthread_rwlock_unlock(plock);
}
- gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
+ //gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
if (foundHgh == 0) {
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
pthread_rwlock_rdlock(&CrackerIndex[m].columnRWLock);
- gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ //gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
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;
+ //gettimeofday(&tv1,0); ct+=dt(tv0,tv1);
tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
pthread_rwlock_wrlock(plock);
- gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ //gettimeofday(&tv1,0); wt+=dt(tv0,tv1);
tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
pthread_rwlock_unlock(plock);
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;
+ //gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
pthread_rwlock_wrlock(&CrackerIndex[m].columnRWLock);
- gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ //gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+
t = (int *) Tloc(b, BUNfirst(b));
if (IndexSize < IndexStop)
if (gapH>0)
@@ -637,8 +704,16 @@ createView:
posh = BUNlast(b)-1;
idxFirst = BUNfirst(c);
+
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
+
pthread_rwlock_rdlock(&CrackerIndex[m].columnRWLock);
- gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ //gettimeofday(&tv1,0); wt+=dt(tv0,tv1); tv0=tv1;
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t1\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
lowNode = findNodeL_@1(*low, *inclusiveLow, CrackerIndex[m].Tree, c,
idxFirst, NULL);
if (lowNode == NULL){
lowNodeNext = NULL;
@@ -669,7 +744,7 @@ createView:
BBPunfix(b->batCacheid);
BBPunfix(c->batCacheid);
- gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
+ //gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;
if (createIndex==1)
{
@@ -677,6 +752,10 @@ createView:
createIndex=0;
}
+ t0 = GDKusec();
+ fprintf(file,"timestamp=\t" LLFMT "\t2\n",t0);
+ fprintf(file,"timestamp=\t" LLFMT "\t0\n",t0);
+ fclose(file);
/*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);*/
fclose(ofp);
return MAL_SUCCEED;
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list