Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv16968

Modified Files:
      Tag: Nov2009
        sql.mx sql_scenario.mx 
Log Message:
Make the profile information accessible for inspection using SQL.


Index: sql_scenario.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_scenario.mx,v
retrieving revision 1.356.2.5
retrieving revision 1.356.2.6
diff -u -d -r1.356.2.5 -r1.356.2.6
--- sql_scenario.mx     25 Oct 2009 10:03:36 -0000      1.356.2.5
+++ sql_scenario.mx     25 Oct 2009 12:33:33 -0000      1.356.2.6
@@ -308,7 +308,7 @@
        if (optimizer == NULL)
                optimizer= "default_pipe";
        SQLglobal("optimizer", setOptimizers(optimizer));
-       SQLglobal("trace","ticks,statement");
+       SQLglobal("trace","show,ticks,stmt");
 
        typename = "sec_interval";
        sql_find_subtype(&ctype, typename, 0, 0);
@@ -874,7 +874,7 @@
        int i = 0;
        InstrPtr q,r;
        MalBlkPtr mb = c->curprg->def;
-       str traceFlag, t,s, def= GDKstrdup("ticks,statement");
+       str traceFlag, t,s, def= GDKstrdup("show,ticks,stmt");
 
        traceFlag = stack_get_string(be->mvc, "trace");
        if ( traceFlag && *traceFlag){
@@ -886,22 +886,12 @@
        if (onoff){
                if ( strstr(def,"keep") == 0)
                        q = newStmt(mb,"profiler","reset");
-               q = newStmt(mb,"profiler","activate");
-
-               do {
-                       s= t;
-                       t= strchr(t+1,',');
-                       if ( t )
-                               *t = 0;
-                       if ( strcmp("keep",s) )
-                               q = pushStr(mb, q, s);
-               } while (t++);
-
                q = newStmt(mb,"profiler","setFilter");
                q = pushStr(mb,q, "*");
                q = pushStr(mb,q, "*");
                q = newStmt(mb,"profiler","start");
-       } else {
+       } else 
+       if ( def && strstr(def,"show") ) {
                r= newInstruction(mb,ASSIGNsymbol);
                setModuleId(r,putName("io",2));
                getArg(r,0)= newTmpVariable(mb,TYPE_void);
@@ -912,7 +902,7 @@
                        t= strchr(t+1,',');
                        if ( t )
                                *t = 0;
-                       if ( strcmp("keep",s) ) {
+                       if ( strcmp("keep",s) && strcmp("show",s) ) {
                                q = newStmt(mb,"profiler","getTrace");
                                q = pushStr(mb, q, s);
                                r= pushArgument(mb,r, getArg(q,0));

Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.358.2.5
retrieving revision 1.358.2.6
diff -u -d -r1.358.2.5 -r1.358.2.6
--- sql.mx      23 Oct 2009 19:22:30 -0000      1.358.2.5
+++ sql.mx      25 Oct 2009 12:33:31 -0000      1.358.2.6
@@ -448,6 +448,10 @@
 address dump_opt_stats
 comment "dump the optimizer rewrite statistics";
 
+pattern dump_trace() :bat[:str,:bat]
+address dump_trace
+comment "dump the trace statistics";
+
 @- SQL function aliases
 The code generate should identify the precise module
 target for all functions. This creates quite some
@@ -3970,6 +3974,23 @@
        return MAL_SUCCEED;
 }
 
+/* str dump_opt_stats(int *r); */
+str
+dump_trace(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+       mvc *m = NULL;
+       str msg = getContext(cntxt,mb, &m, NULL);
+       BAT *t;
+       int *r = (int *) getArgReference(stk, pci, 0);
+
+       if (msg)
+               return msg;
+       t= TRACEtable();
+       *r = t->batCacheid;
+       BBPkeepref(*r);
+       return MAL_SUCCEED;
+}
+
 /* str sql_rowid(oid *rid, ptr v, str *sname, str *tname); */
 str 
 sql_rowid(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to