Re: [Monetdb-developers] [Monetdb-checkins] MonetDB5/src/optimizer opt_history.mx, , NONE, 1.1 Makefile.ag, , 1.62, 1.63 opt_prelude.mx, , 1.49, 1.50
Martin Kersten wrote:
Update of /cvsroot/monetdb/MonetDB5/src/optimizer In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21452
Modified Files: Makefile.ag opt_prelude.mx Added Files: opt_history.mx Log Message: include the SQL history code optimizer
U opt_prelude.mx
--- NEW FILE: opt_history.mx --- ...............
static int OPThistoryImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { int i, limit,slimit; InstrPtr p=0, *old= mb->stmt, q,r; int qid, argc, elaps, inblock, oublock, arg, ctime;
You need to initialize it before you use it.... qid = 0 ? Regards, Romulo
int returnseen=0;
(void) pci; (void) stk; /* to fool compilers */
#ifdef _DEBUG_OPT_QUERYHISTORY_ stream_printf(cntxt->fdout,"ENTERING TRACE CODE \n"); printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL); #else (void) cntxt; #endif
limit= mb->stop; slimit= mb->ssize; newMalBlkStmt(mb, mb->ssize+20); /* a new statement stack */
pushInstruction(mb, old[0]); /* collect the statistics */ @:initCounters@
for (i = 1; i < limit; i++) { p= old[i];
if ( p->token== ENDsymbol || p->barrier == RETURNsymbol || p->barrier == YIELDsymbol){ if (returnseen && p->token == ENDsymbol) { pushInstruction(mb,p); continue; } returnseen++; q = newStmt(mb,"alarm","usec"); setVarType(mb,getArg(q,0), TYPE_lng); r = newStmt(mb,"calc","-"); r = pushArgument(mb,r, getArg(q,0)); r = pushArgument(mb,r, elaps); elaps= getArg(r,0);
q = newStmt(mb,"bbp","getDiskReads"); setVarType(mb,getArg(q,0), TYPE_lng); r = newStmt(mb,"calc","-"); r = pushArgument(mb,r, getArg(q,0)); r = pushArgument(mb,r, inblock); inblock= getArg(r,0);
q = newStmt(mb,"bbp","getDiskWrites"); setVarType(mb,getArg(q,0), TYPE_lng); r = newStmt(mb,"calc","-"); r = pushArgument(mb,r, getArg(q,0)); r = pushArgument(mb,r, oublock); oublock= getArg(r,0);
/* prepare the call to the history manager */ q = newStmt(mb,"sql","argRecord"); setVarType(mb,getArg(q,0), TYPE_str); for ( argc=0; argc < old[0]->argc; argc++) q = pushArgument(mb, q, getArg(old[0],argc));
arg= getArg(q,0);
q = newStmt(mb,"user","keepcall"); q = pushInt(mb, q, qid); /* query identifier */ q = pushArgument(mb, q, ctime); /* arguments */ q = pushArgument(mb, q, arg); /* arguments */ q = pushArgument(mb, q, elaps); /* elaps */ q = pushArgument(mb, q, inblock);/* inblock */ q = pushArgument(mb, q, oublock);/* oublock */ }
pushInstruction(mb,p); if (p->barrier == YIELDsymbol){ /* the factory yield may return */ @:initCounters@ } }
#ifdef _DEBUG_OPT_QUERYHISTORY_ stream_printf(cntxt->fdout,"LEAVING QUERYHISTORY CODE INJECTION\n"); printFunction(cntxt->fdout,mb,LIST_MAL_ALL); #endif for( ; i
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Monetdb-checkins mailing list Monetdb-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
participants (1)
-
Romulo Goncalves