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

Modified Files:
        mal_client.mx mal_instruction.mx mal_interpreter.mx 
        mal_recycle.mx 
Log Message:
the getVolume function now returns the Volume read or writen by a
functions. It handles the cases that the input/output maybe a view.
In case of views much less is read/writen.

The recycler can now directly use the corrected obytes (bytes writen). There
is no need for an extra sbytes (bytes consumed).


Index: mal_client.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_client.mx,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- mal_client.mx       8 Feb 2008 22:36:31 -0000       1.164
+++ mal_client.mx       11 Mar 2008 11:39:42 -0000      1.165
@@ -131,22 +131,22 @@
        str     oldscenario;
        void    *state[7], *oldstate[7];
        MALfcn  phase[7], oldphase[7];
-       sht             stage;          /* keep track of the phase being ran */
-       char    itrace;     /* trace execution using interactive mdb */
+       sht     stage;     /* keep track of the phase being ran */
+       char    itrace;    /* trace execution using interactive mdb */
                                                /* if set to 'S' it will put 
the process to sleep */
        short   debugOptimizer,debugScheduler;
 @-
 For program debugging we need information on the timer and memory
 usage patterns.
 @h
-       sht             flags;  /* resource tracing flags */
-       lng     timer;  /* trace time in usec */
-       lng             bigfoot; /* maximum virtual memory use */
-       lng             vmfoot; /* virtual memory use */
+       sht     flags;   /* resource tracing flags */
+       lng     timer;   /* trace time in usec */
+       lng     bigfoot; /* maximum virtual memory use */
+       lng     vmfoot;  /* virtual memory use */
 
 #define timerFlag      1
 #define memoryFlag     2
-#define ioFlag 4
+#define ioFlag         4
 #define flowFlag       8
 #define bigfootFlag    16
 @-

Index: mal_recycle.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_recycle.mx,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- mal_recycle.mx      11 Mar 2008 10:50:34 -0000      1.29
+++ mal_recycle.mx      11 Mar 2008 11:39:45 -0000      1.30
@@ -227,7 +227,7 @@
        long cnt;
        int i;
        for( i=0; i<recycleBlk->stop; i++)
-               cnt += recycleBlk->profiler[i].sbytes;
+               cnt += recycleBlk->profiler[i].obytes;
        return cnt;
 }
 
@@ -561,8 +561,8 @@
                int i;
                /*      3: size cost model */
                if(     recycleVolume && !RECYCLEfind(mb,stk,p)){
-                       int rd= getVolume(stk,p, 1)/ RU;
-                       int wr= getVolume(stk,p, 0)/ RU;
+                       int rd = getVolume(stk,p, 1)/ RU;
+                       int wr = getVolume(stk,p, 0)/ RU;
 
                        if( rd+wr >recycleVolume){
                                i = RECYCLEnew(mb,stk, p);
@@ -579,8 +579,8 @@
                int i;
                /*      4: volumetric cost model (time x size )*/
                if(     recycleVolume && !RECYCLEfind(mb,stk,p)){
-                       int rd= getVolume(stk,p, 1)/ RU;
-                       int wr= getVolume(stk,p, 0)/ RU;
+                       int rd = getVolume(stk,p, 1)/ RU;
+                       int wr = getVolume(stk,p, 0)/ RU;
 
                        if( recycleAlpha *(rd+wr) + (1-recycleAlpha)* clk >
                                                 recycleVolume * recycleTime){

Index: mal_interpreter.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_interpreter.mx,v
retrieving revision 1.216
retrieving revision 1.217
diff -u -d -r1.216 -r1.217
--- mal_interpreter.mx  4 Mar 2008 09:20:07 -0000       1.216
+++ mal_interpreter.mx  11 Mar 2008 11:39:44 -0000      1.217
@@ -169,8 +169,8 @@
        }
 }
 @-
-The bigfoot memory tracker keeps track on the space
-occupancy of BATs. It ignores for the time being the heaps.
+The bigfoot memory tracker keeps track on the space occupancy of BATs. 
+It ignores for the time being the heaps for the variable sized atoms.
 @c
 static INLINE void 
 updateBigFoot(Client cntxt, int bid, int add)
@@ -178,18 +178,21 @@
        BAT *b;
 
        if (bid != bat_nil && BBP_lrefs(bid) == 1){
+               int cnt = 0;
                b= BATdescriptor(bid);
-               if( b==0) return;
+               if (b == NULL) 
+                       return;
                /* count it once ! */
-               if( add){
-                       cntxt->vmfoot += headsize(b,BATcount(b));
-                       cntxt->vmfoot += tailsize(b,BATcount(b));
+               cnt = BATcount(b);
+               if (add) {
+                       cntxt->vmfoot += VIEWhparent(b)?0:headsize(b,cnt);
+                       cntxt->vmfoot += VIEWtparent(b)?0:tailsize(b,cnt);
                } else {
-                       cntxt->vmfoot -= headsize(b,BATcount(b));
-                       cntxt->vmfoot -= tailsize(b,BATcount(b));
+                       cntxt->vmfoot -= VIEWhparent(b)?0:headsize(b,cnt);
+                       cntxt->vmfoot -= VIEWtparent(b)?0:tailsize(b,cnt);
                }
-               if( cntxt->vmfoot > cntxt->bigfoot)
-                       cntxt->bigfoot= cntxt->vmfoot;
+               if (cntxt->vmfoot > cntxt->bigfoot)
+                       cntxt->bigfoot = cntxt->vmfoot;
                BBPunfix(b->batCacheid);
        }
 }
@@ -1031,7 +1034,6 @@
                        bat bid = stk->stk[getArg(pci,i)].val.br.id;
                        /* update the bigfoot information */
                        updateBigFoot(cntxt, bid, TRUE);
-                       /* BAT *b;*/
                        if (backup[i]){
                                if (backup[i] != bid) {
                                        /* possible garbage collect the 
variable */
@@ -1046,6 +1048,7 @@
 loss of a factor 4(?) on the micro benchmarks.
 It does not belong here, but should be propagated 
 to the operators.
+                       BAT *b;
                        if ((b = BATdescriptor(bid)) != NULL) {
                                BATsettrivprop(b);
                                BBPunfix(bid);
@@ -1608,7 +1611,7 @@
 #endif
 @= beginProfile
 #ifdef MALprofiler
-       if( malProfileMode == 0)
+       if (malProfileMode == 0)
                /* mostly true */;
        else {
                setFilterOnBlock(mb, 0, 0);
@@ -1701,17 +1704,30 @@
 {
        int i, limit, vol=0;
        BAT *b;
+       int isview = 0;
 
-       limit= rd ==0? pci->retc: pci->argc;
-       i= rd? pci->retc:0;
-       for(; i<limit; i++)
-       if( stk->stk[getArg(pci,i)].vtype == TYPE_bat){
-               b= BATdescriptor( stk->stk[getArg(pci,i)].val.br.id);
-               if( b==0) continue;
-               vol += headsize(b,BATcount(b));
-               vol += tailsize(b,BATcount(b));
+       limit = rd == 0?pci->retc:pci->argc;
+       i = rd?pci->retc:0;
+       
+       if( stk->stk[getArg(pci,0)].vtype == TYPE_bat){
+               b = BATdescriptor(stk->stk[getArg(pci,i)].val.br.id);
+               isview = isVIEW(b);
                BBPunfix(b->batCacheid);
        }
+       for(; i<limit; i++) {
+               if (stk->stk[getArg(pci,i)].vtype == TYPE_bat){
+                       int cnt = 0;
+                       b = BATdescriptor(stk->stk[getArg(pci,i)].val.br.id);
+                       if (b==NULL) 
+                               continue;
+                       cnt = BATcount(b);
+                       /* Usually reading views cost as much as full bats. 
+                          But when we output a slice that is not the case. */
+                       vol += ((rd && !isview) || 
!VIEWhparent(b))?headsize(b,cnt):0;
+                       vol += ((rd && !isview) || 
!VIEWtparent(b))?tailsize(b,cnt):0;
+                       BBPunfix(b->batCacheid);
+               }
+       }
        return vol;
 }
 

Index: mal_instruction.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_instruction.mx,v
retrieving revision 1.306
retrieving revision 1.307
diff -u -d -r1.306 -r1.307
--- mal_instruction.mx  11 Mar 2008 10:50:32 -0000      1.306
+++ mal_instruction.mx  11 Mar 2008 11:39:42 -0000      1.307
@@ -393,9 +393,8 @@
        long counter;
        long ticks;             /* micro seconds spent */
        bit trace;              /* facilitate filter-based profiling */
-       int     ibytes;         /* bytes read by an instruction */
+       int ibytes;             /* bytes read by an instruction */
        int obytes;             /* bytes written by an instruction */
-       int sbytes;             /* bytes acually consumed by an instruction */
 } *ProfPtr, ProfRecord;
 
 typedef struct MALBLK {


-------------------------------------------------------------------------
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