Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4332

Modified Files:
        mal_recycle.mx 
Log Message:
A little statistics collection


Index: mal_recycle.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_recycle.mx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mal_recycle.mx      5 Mar 2008 08:58:59 -0000       1.11
+++ mal_recycle.mx      6 Mar 2008 10:50:00 -0000       1.12
@@ -61,7 +61,7 @@
 #include "mal.h"
 #include "mal_instruction.h"
 
-#define _DEBUG_RECYCLE_ /* trace behavior */
+/* #define _DEBUG_RECYCLE_  trace behavior */
 
 mal_export str RECYCLEdump(int *ret);
 mal_export str RECYCLEstart(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
@@ -197,10 +197,18 @@
 str
 RECYCLEdump(int *ret)
 {
+       int i;
+
        (void) ret;
        stream_printf(GDKout,"Recycler  catalog \n");
        printFunction(GDKout,recycleBlk, LIST_MAL_ALL);
 
+       /* and dump the statistics */
+       for(i=0; i< recycleBlk->stop; i++){
+               stream_printf(GDKout,"#%d count=%d ticks=%d\n", i,
+                       recycleBlk->profiler[i].counter,
+                       recycleBlk->profiler[i].ticks);
+       }
        return MAL_SUCCEED;
 }
 
@@ -261,6 +269,7 @@
        i= recycleBlk->stop;
        pushInstruction(recycleBlk,q);
        recycleBlk->profiler[i].counter =1;
+       recycleBlk->profiler[i].ticks = GDKusec()-s->clk;
 #ifdef _DEBUG_RECYCLE_
        stream_printf(GDKout,"RECYCLE catalog \n");
        printFunction(GDKout,recycleBlk,LIST_MAL_ALL);
@@ -301,7 +310,7 @@
 static int
 RECYCLEreuse(MalBlkPtr mb, MalStkPtr s, InstrPtr p)
 {
-       int i, j, nbid, bid= -1 , ridx, idx;
+       int i, j, nbid, bid= -1 , ridx, idx,pc = -1;
        InstrPtr q;
        static str selectRef;
        static str uselectRef;
@@ -345,6 +354,7 @@
                                        nbid=getVarConstant(recycleBlk, 
getArg(q,0)).val.bval; 
                                        if( bid == -1){
                                                bid = nbid;
+                                               pc= i;
                                                b1= BATdescriptor(bid);
                                                BBPkeepref(bid);
 #ifdef _DEBUG_RECYCLE_
@@ -363,6 +373,7 @@
                                                        BBPreleaseref(bid);
                                                        BBPkeepref(nbid);
                                                        bid= nbid;
+                                                       pc= i;
                                                } else {
                                                        BBPreleaseref(bid);
                                                        BBPreleaseref(nbid);
@@ -390,13 +401,16 @@
                stream_printf(GDKout,"RECYCLEreuse exact\n");
                printInstruction(GDKout,mb,p, LIST_MAL_ALL);
 #endif
+                       recycleBlk->profiler[i].counter++;
                        return 1;
                        notfound: continue;
                }
        }
-       if( bid >=0)
+       if( bid >=0){
                /* replace selection argument */
                s->stk[getArg(p,1)].val.bval= bid;
+               recycleBlk->profiler[pc].counter++;
+       }
        return 0;
 
 }
@@ -469,6 +483,7 @@
 #ifdef _DEBUG_RECYCLE_
                stream_printf(GDKout,"RECYCLEexit time %d \n",clk);
 #endif
+               ;
        }
 }
 @-


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to