Changeset: 260b01b9e17e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=260b01b9e17e
Modified Files:
monetdb5/scheduler/Tests/query00.mal
monetdb5/scheduler/mut_transforms.c
Branch: mutation
Log Message:
Inherit the profiler settings.
diffs (214 lines):
diff --git a/monetdb5/scheduler/Tests/query00.mal
b/monetdb5/scheduler/Tests/query00.mal
--- a/monetdb5/scheduler/Tests/query00.mal
+++ b/monetdb5/scheduler/Tests/query00.mal
@@ -1,16 +1,9 @@
-# example framework for a mutation based execution stack
+# example framework for a multicore based execution stack
# illustrate how it would appear after an optimizer call.
function initialize{unsafe}():bat[:oid,:lng];
b:= bat.new(:oid,:lng);
- INT_MAX := 2147483647;
- dbgmsk_restore := mdb.getDebug();
- dbgmsk_unset := 8+8388608;
- dbgmsk_keep := calc.xor(INT_MAX,dbgmsk_unset);
- dbgmsk_set := calc.and(dbgmsk_restore,dbgmsk_keep);
- mdb.setDebug(dbgmsk_set);
-
r:= mmath.srand(0);
barrier i:= 0:lng;
k:= mmath.rand();
@@ -18,27 +11,57 @@ function initialize{unsafe}():bat[:oid,:
bat.append(b,l);
redo i:= iterator.next(1:lng,1000000:lng);
exit i;
- mdb.setDebug(dbgmsk_restore);
return b;
end initialize;
-function query(b:bat[:oid,:lng]);
+function query(run:int, b:bat[:oid,:lng]);
t0:= alarm.usec();
+ profiler.activate("ticks");
+ profiler.activate("stmt");
+ profiler.setAll();
+ profiler.start();
+
barrier z:= language.dataflow();
s1 := algebra.subselect(b,1:lng,99:lng,true,false,false);
- s2 := algebra.subselect(b,1:lng,999:lng,true,false,false);
- s3 := algebra.subselect(b,1:lng,9999:lng, true,false,false);
+ #s2 := algebra.subselect(b,1:lng,999:lng,true,false,false);
+ #s3 := algebra.subselect(b,1:lng,9999:lng, true,false,false);
exit z;
+
t1:= alarm.usec();
t2 := t1-t0;
- io.printf("#%d\n",t2);
+ io.printf("#run %d %d\n",run,t2);
+
+ profiler.stop();
+ stmt:= profiler.getTrace("stmt");
+ ticks:= profiler.getTrace("ticks");
+ io.print(ticks,stmt);
+
end query;
-b:= initialize();
-optimizer.mutation("user","query");
-user.query(b);
-user.query(b);
-user.query(b);
-user.query(b);
-user.query(b);
+optimizer.multicore("user","query");
+function testrun();
+ b:= initialize();
+ user.query(0,b);
+ user.query(1,b);
+ user.query(2,b);
+ user.query(3,b);
+ user.query(4,b);
+ user.query(5,b);
+ user.query(6,b);
+ user.query(7,b);
+ user.query(8,b);
+ user.query(9,b);
+ user.query(10,b);
+ user.query(11,b);
+ user.query(12,b);
+ user.query(13,b);
+ user.query(14,b);
+ user.query(15,b);
+ user.query(16,b);
+ user.query(17,b);
+ user.query(18,b);
+ user.query(19,b);
+ user.query(20,b);
+end testrun;
+testrun();
diff --git a/monetdb5/scheduler/mut_transforms.c
b/monetdb5/scheduler/mut_transforms.c
--- a/monetdb5/scheduler/mut_transforms.c
+++ b/monetdb5/scheduler/mut_transforms.c
@@ -38,7 +38,7 @@ void
mutationJoin(Client cntxt, Mutant m){
int pc = m->target, i, j, k, limit, b1,b2, v1,v2, z1,z2;
InstrPtr p=0, *old= m->src->stmt, q;
- int matpc = 0;
+ int matpc = 0, profiler;
(void) cntxt;
limit= m->src->stop;
@@ -65,6 +65,7 @@ mutationJoin(Client cntxt, Mutant m){
pushInstruction(m->src,p);
continue;
}
+ profiler = m->src->profiler[i].trace;
q= newStmt(m->src, batRef, partitionRef);
setVarType(m->src, getArg(q,0), getArgType(m->src, p,
p->retc));
b1 = getArg(q,0);
@@ -74,6 +75,8 @@ mutationJoin(Client cntxt, Mutant m){
m->stk->stk[getArg(q, q->argc-1)].val.ival = 2;
q = pushInt(m->src,q,0);
m->stk->stk[getArg(q, q->argc-1)].val.ival = 0;
+ // inherit profiling
+ m->src->profiler[m->src->stop-1].trace = profiler;
q= newStmt(m->src, batRef, partitionRef);
setVarType(m->src, getArg(q,0), getArgType(m->src, p,
p->retc));
@@ -84,17 +87,24 @@ mutationJoin(Client cntxt, Mutant m){
m->stk->stk[getArg(q, q->argc-1)].val.ival = 2;
q = pushInt(m->src,q,1);
m->stk->stk[getArg(q, q->argc-1)].val.ival = 1;
+ // inherit profiling
+ m->src->profiler[m->src->stop-1].trace = profiler;
q= copyInstruction(p);
getArg(q,2)= b1;
v1 = getArg(q,0)= newTmpVariable(m->src,TYPE_any);
z1 = getArg(q,1)= newTmpVariable(m->src,TYPE_any);
pushInstruction(m->src,q);
+ // inherit profiling
+ m->src->profiler[m->src->stop-1].trace = profiler;
+
q= copyInstruction(p);
getArg(q,2)= b2;
v2 = getArg(q,0)= newTmpVariable(m->src,TYPE_any);
z2 = getArg(q,1)= newTmpVariable(m->src,TYPE_any);
pushInstruction(m->src,q);
+ // inherit profiling
+ m->src->profiler[m->src->stop-1].trace = profiler;
(void)z1;
(void)z2;
@@ -142,13 +152,14 @@ void
mutationSelect(Client cntxt, Mutant m){
int pc = m->target, i, j, k, limit, b1,b2, v1,v2;
InstrPtr p=0, *old= m->src->stmt, q;
- int matpc = 0;
+ int matpc = 0, profiler=0;
(void) cntxt;
limit= m->src->stop;
if ( newMalBlkStmt(m->src, m->src->ssize) < 0)
return;
+ assert( m->src->profiler);
pushInstruction(m->src, old[0]);
for (i = 1; i < limit; i++) {
p= old[i];
@@ -169,6 +180,8 @@ mutationSelect(Client cntxt, Mutant m){
pushInstruction(m->src,p);
continue;
}
+ profiler = m->src->profiler[i].trace;
+
q= newStmt(m->src, batRef, partitionRef);
setVarType(m->src, getArg(q,0), getArgType(m->src, p,
p->retc));
b1 = getArg(q,0);
@@ -178,25 +191,32 @@ mutationSelect(Client cntxt, Mutant m){
m->stk->stk[getArg(q, q->argc-1)].val.ival = 2;
q = pushInt(m->src,q,0);
m->stk->stk[getArg(q, q->argc-1)].val.ival = 0;
+ // inherit profiling
+ m->src->profiler[m->src->stop-1].trace = profiler;
q= newStmt(m->src, batRef, partitionRef);
setVarType(m->src, getArg(q,0), getArgType(m->src, p,
p->retc));
b2 = getArg(q,0);
q = pushArgument(m->src,q,getArg(p,1));
q = pushInt(m->src,q,2);
- // update the stack as well, because we are executing
- m->stk->stk[getArg(q, q->argc-1)].val.ival = 2;
q = pushInt(m->src,q,1);
m->stk->stk[getArg(q, q->argc-1)].val.ival = 1;
+ // inherit profiling
+ m->src->profiler[m->src->stop-1].trace = profiler;
q= copyInstruction(p);
getArg(q,1)= b1;
v1 = getArg(q,0)= newTmpVariable(m->src,TYPE_any);
pushInstruction(m->src,q);
+ // inherit profiling
+ m->src->profiler[getPC(m->src,q)].trace = profiler;
+
q= copyInstruction(p);
getArg(q,1)= b2;
v2 = getArg(q,0)= newTmpVariable(m->src,TYPE_any);
pushInstruction(m->src,q);
+ // inherit profiling
+ m->src->profiler[m->src->stop-1].trace = profiler;
// replace its use in other mat packs
for (j = i; j < limit; j++) {
@@ -218,6 +238,8 @@ mutationSelect(Client cntxt, Mutant m){
getArg(q,0)= getArg(p,0);
q= pushArgument(m->src,q,v1);
q= pushArgument(m->src,q,v2);
+ // inherit profiling
+ m->src->profiler[m->src->stop-1].trace =
profiler;
}
//pushInstruction(m->src,p);
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list